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- 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?
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 ;
3+ let age = 33 ;
44age = age + 1 ;
5+ console . log ( age ) ;
Original file line number Diff line number Diff line change 11// Currently trying to print the string "I was born in Bolton" but it isn't working...
22// what's the error ?
33
4+ //The error was ReferenceError: cannot access `cityOfBirth` before initialization
5+ //by swapping the order of the two lines, the error will be fixed.
6+
47console . log ( `I was born in ${ cityOfBirth } ` ) ;
58const cityOfBirth = "Bolton" ;
Original file line number Diff line number Diff line change 1- const cardNumber = 4533787178994213 ;
1+ const cardNumber = " 4533787178994213" ;
22const last4Digits = cardNumber . slice ( - 4 ) ;
3-
3+ console . log ( last4Digits ) ;
44// The last4Digits variable should store the last 4 digits of cardNumber
55// However, the code isn't working
66// Before running the code, make and explain a prediction about why the code won't work
7+ // i predict that the code doesn't work its because of two things, first i thought its case sensitive things
8+ // the second one is the type of variable, i thought the slice method is only for string type variable.
9+
710// Then run the code and see what error it gives.
811// Consider: Why does it give this error? Is this what I predicted? If not, what's different?
12+ /*
13+ I run the code and it gives me an error that says "TypeError: cardNumber.slice is not a function".
14+ so i checked the type of cardNumber using typeof operator and it returns number.
15+ */
916// Then try updating the expression last4Digits is assigned to, in order to get the correct value
Original file line number Diff line number Diff line change 11const 12 HourClockTime = "8:53pm" ;
22const 24 hourClockTime = "20:53" ;
3+
4+ // I believe this question is about what the error might be.
5+ // the error is syntaxError: and its because the variable name stats wit a number which is not allowed in Javascript.
6+ // removing the number or use the number next to the string/s.
You can’t perform that action at this time.
0 commit comments