File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change 11// Predict and explain first...
2- // =============> write your prediction here
2+ // =============> I predict that we will not need to write let in line 8 as str is already declared
3+ // as an argument within the function captialise.
34
45// call the function capitalise with a string input
56// interpret the error message and figure out why an error is occurring
67
8+ // function capitalise (str) {
9+ // let str = `${str[0].toUpperCase()}${str.slice(1)}`;
10+ // return str;
11+ // }
12+
13+ // capitalise ('hello');
14+ //==============> A syntaxError occurred as 'str' is being cleared.
15+
16+
717function capitalise ( str ) {
8- let str = `${ str [ 0 ] . toUpperCase ( ) } ${ str . slice ( 1 ) } ` ;
18+ str = `${ str [ 0 ] . toUpperCase ( ) } ${ str . slice ( 1 ) } ` ;
919 return str ;
1020}
21+ console . log ( capitalise ( 'hello' ) ) ;
22+
1123
12- // =============> write your explanation here
13- // =============> write your new code here
You can’t perform that action at this time.
0 commit comments