File tree Expand file tree Collapse file tree 5 files changed +23
-7
lines changed
Sprint-1/2-mandatory-errors Expand file tree Collapse file tree 5 files changed +23
-7
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+ By comment both the line 1 and 2 out and the system should ignore these 2 line and see them as comment.
4+ */
Original file line number Diff line number Diff line change 11// trying to create an age variable and then reassign the value by 1
22
3- const age = 33 ;
4- age = age + 1 ;
3+ let age = 33 ;
4+ age = ++ age ;
5+
6+ console . log ( age ) ;
7+
8+ /*By changing the variable from const to let since const variable value can't be change. I used prefix to increase the value and reassign it right away.*/
Original file line number Diff line number Diff line change 33
44console . log ( `I was born in ${ cityOfBirth } ` ) ;
55const cityOfBirth = "Bolton" ;
6+
7+ /*the main the error here is that the console.log try to print the expression string template with the variable cityOfBirth. But since in the variable
8+ cityOfBirth declare after the console.log, so the console.log when try to involve the cityOfBirth will return error since the it doesn't exist.
9+ */
Original file line number Diff line number Diff line change 11const cardNumber = 4533787178994213 ;
2- const last4Digits = cardNumber . slice ( - 4 ) ;
2+ const last4Digits = Number ( cardNumber . toString ( ) . slice ( - 4 ) ) ;
3+ console . log ( last4Digits ) ;
4+ console . log ( typeof last4Digits ) ;
35
46// The last4Digits variable should store the last 4 digits of cardNumber
57// However, the code isn't working
Original file line number Diff line number Diff line change 1- const 12 HourClockTime = "20:53" ;
2- const 24 hourClockTime = "08:53" ;
1+ const $12HourClockTime = "20:53" ;
2+ const $24HourClockTime = "08:53" ;
3+ console . log ( $12HourClockTime ) ;
4+ console . log ( $24HourClockTime ) ;
5+
6+ /*For this error I I fix by add $(money-sign)before the 12 and 24 variable name because in JS number can't be used to begin writing a variable name */
You can’t perform that action at this time.
0 commit comments