File tree Expand file tree Collapse file tree
Sprint-1/2-mandatory-errors Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- const cardNumber = " 4533787178994213" ;
2- const last4Digits = cardNumber . slice ( - 4 ) ;
1+ const cardNumber = 4533787178994213 ;
2+ const last4Digits = cardNumber . toString ( ) . slice ( - 4 ) ;
33console . log ( last4Digits ) ;
44
55// The last4Digits variable should store the last 4 digits of cardNumber
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+ // =============> str has already been declared in the function.
13+ // =============>
714function capitalise ( str ) {
8- let str = `${ str [ 0 ] . toUpperCase ( ) } ${ str . slice ( 1 ) } ` ;
15+ str = `${ str [ 0 ] . toUpperCase ( ) } ${ str . slice ( 1 ) } ` ;
916 return str ;
1017}
1118
12- // =============> write your explanation here
13- // =============> write your new code here
19+ console . log ( capitalise ( "tommy is a good boy" ) ) ;
You can’t perform that action at this time.
0 commit comments