File tree Expand file tree Collapse file tree
Sprint-2/2-mandatory-errors Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,5 +6,4 @@ console.log(`I was born in ${cityOfBirth}`);
66
77
88// The error is ReferenceError: Cannot access 'cityOfBirth' before initialization
9- // Answer: the correct variable is not called
10- // I changed the console to print the actual variable value
9+ // Answer: I switched the order by declaring the const first before calling /printing
Original file line number Diff line number Diff line change @@ -11,4 +11,6 @@ console.log(last4Digits)
1111// Then try updating the expression last4Digits is assigned to, in order to get the correct value
1212
1313//Prediction was the code would run successfully without error although with the wrong results due to absence of syntax errors in the file
14- // Error returned: TypeError: cardNumber.slice is not a function
14+ // Error returned: TypeError: cardNumber.slice is not a function
15+ // Lesson learnt here; slice method is only available for strings or arrays not numbers
16+ // So converted the cardNumber into a string first
Original file line number Diff line number Diff line change 1- const 12 HourClockTime = "8:53pm" ;
2- const 24 hourClockTime = "20:53" ;
1+ const twelveHourClockTime = "8:53pm" ;
2+ const twentyFourHourClockTime = "20:53" ;
3+ console . log ( twelveHourClockTime ) ;
4+ console . log ( twentyFourHourClockTime ) ;
5+
6+ // Error - SyntaxError: Invalid or unexpected token
7+ // lesson learnt - variables cannot start with a number
You can’t perform that action at this time.
0 commit comments