File tree Expand file tree Collapse file tree 1 file changed +4
-14
lines changed
Expand file tree Collapse file tree 1 file changed +4
-14
lines changed Original file line number Diff line number Diff line change 11// Predict and explain first...
22// =============> write your prediction here
3- //we should have an error showing that str already exists so we cannot declare it again inside the function.
43
54// call the function capitalise with a string input
65// interpret the error message and figure out why an error is occurring
76
8- //function capitalise(str) {
9- // let str = `${str[0].toUpperCase()}${str.slice(1)}`;
10- // return str;
11- //}
12-
13- //console.log(capitalise("cat"));
14-
15- // =============> write your explanation here
16- //str has been passed down as a parameter so we cannot declare it again. we would need to declare a different variable name.
17- // =============> write your new code here
187function capitalise ( str ) {
19- let capitalisedStr = `${ str [ 0 ] . toUpperCase ( ) } ${ str . slice ( 1 ) } ` ;
20- return capitalisedStr ;
8+ let str = `${ str [ 0 ] . toUpperCase ( ) } ${ str . slice ( 1 ) } ` ;
9+ return str ;
2110}
2211
23- console . log ( capitalise ( "cat" ) ) ;
12+ // =============> write your explanation here
13+ // =============> write your new code here
You can’t perform that action at this time.
0 commit comments