There was an error while loading. Please reload this page.
1 parent 5c39a47 commit 0707b11Copy full SHA for 0707b11
1 file changed
Sprint-2/2-mandatory-errors/4.js
@@ -1,2 +1,10 @@
1
-const 12HourClockTime = "8:53pm";
2
-const 24hourClockTime = "20:53";
+const twelveHourClockTime = "8:53pm";
+const twentyFourHourClockTime = "20:53";
3
+
4
+// Error: SyntaxError: Invalid or unexpected token
5
+// Cause: I originally named the variables 12HourClockTime and 24hourClockTime,
6
+// but JavaScript doesn't allow variable names to start with a number.
7
+// They have to start with a letter, an underscore, or a dollar sign.
8
+// The parser was reading 12 as a number and then got stuck on the "H".
9
+// Fix: Renamed them to twelveHourClockTime and twentyFourHourClockTime so they
10
+// start with letters instead of digits.
0 commit comments