File tree Expand file tree Collapse file tree 2 files changed +25
-8
lines changed
Sprint-1/2-mandatory-errors Expand file tree Collapse file tree 2 files changed +25
-8
lines changed Original file line number Diff line number Diff line change 1- This is just an instruction for the first activity - but it is just for human consumption
2- We don 't want the computer to run these 2 lines - how can we solve this problem?
1+ ///This is just an instruction for the first activity - but it is just for human consumption
2+ //We don't want the computer to run these 2 lines - how can we solve this problem?
3+
4+ // in code use backslashes to create comments.
Original file line number Diff line number Diff line change 11// Predict and explain first...
2- // =============> write your prediction here
2+ // =============> write your prediction here:
3+ // I think their will be an error because of the str tag
4+
5+
6+
7+
38
49// call the function capitalise with a string input
10+ console . log ( capitalise ( "hello" ) ) ; // should print "Hello"
11+
12+
513// interpret the error message and figure out why an error is occurring
614
7- function capitalise ( str ) {
8- let str = `${ str [ 0 ] . toUpperCase ( ) } ${ str . slice ( 1 ) } ` ;
9- return str ;
10- }
1115
12- // =============> write your explanation here
16+ //function capitalise(str) {
17+ //let str = `${str[0].toUpperCase()}${str.slice(1)}`;
18+ //return str;
19+ //}
20+
21+ // =============> write your explanation here:
22+ // str is being used as both the function parameter and a variable inside the function, causing a conflict.
23+
24+
1325// =============> write your new code here
26+
27+ function capitalise ( inputStr ) {
28+ return `${ inputStr [ 0 ] . toUpperCase ( ) } ${ inputStr . slice ( 1 ) } ` ; }
You can’t perform that action at this time.
0 commit comments