File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change 11// Predict and explain first...
22// =============> write your prediction here
3+ // It will show an error message
34
45// call the function capitalise with a string input
56// interpret the error message and figure out why an error is occurring
@@ -8,6 +9,13 @@ function capitalise(str) {
89 let str = `${ str [ 0 ] . toUpperCase ( ) } ${ str . slice ( 1 ) } ` ;
910 return str ;
1011}
12+ capitalise ( "Hello" ) ;
1113
1214// =============> write your explanation here
15+ // SyntaxError: Identifier 'str' has already been declared - This error means that the variable 'str' was declared more than once in the same scope.
16+ // JavaScrip doesn't allow that - once a variable name is declared with let or const, you can't declare it again.
1317// =============> write your new code here
18+ function capitalise ( str ) {
19+ return str [ 0 ] . toUpperCase ( ) + str . slice ( 1 ) ;
20+ }
21+
You can’t perform that action at this time.
0 commit comments