File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change 44// call the function capitalise with a string input
55// interpret the error message and figure out why an error is occurring
66
7+ // function capitalise(str) {
8+ // let str = `${str[0].toUpperCase()}${str.slice(1)}`;
9+ // return str;
10+ // }
11+
12+ // So, the error sounds "SyntaxError: Identifier 'str' has already been declared", it means that we can't declare the sane variable name twice
13+ // =============> write your new code here
714function capitalise ( str ) {
8- let str = `${ str [ 0 ] . toUpperCase ( ) } ${ str . slice ( 1 ) } ` ;
9- return str ;
15+ let capitalisedStr = `${ str [ 0 ] . toUpperCase ( ) } ${ str . slice ( 1 ) } ` ;
16+ return capitalisedStr ;
1017}
1118
12- // =============> write your explanation here
13- // =============> write your new code here
19+ console . log ( capitalise ( "greetings" ) ) ; // Output: "Greetings"
You can’t perform that action at this time.
0 commit comments