Skip to content

Commit 57e97e9

Browse files
committed
Change variable naming starting with letter instead of numbers
1 parent 5b6a38f commit 57e97e9

File tree

1 file changed

+18
-2
lines changed
  • Sprint-1/2-mandatory-errors

1 file changed

+18
-2
lines changed

Sprint-1/2-mandatory-errors/4.js

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,18 @@
1-
const 12HourClockTime = "20:53";
2-
const 24hourClockTime = "08:53";
1+
// const 12HourClockTime = "20:53";
2+
// const 24hourClockTime = "08:53";
3+
4+
/**
5+
* In javascript variable can't start with a number
6+
* Can contain letters, digits (but not at the start), underscore _, and dollar signs $
7+
*
8+
* const 12HourClockTime = "20:53"; will cause a SyntaxError because variable names can't begin with a number.
9+
*
10+
* To fix it by changing the name to start with a letter.
11+
*/
12+
13+
const twelveHourClockTime = "08:53";
14+
const twentyFourClockTime = "20:53";
15+
16+
console.log(twelveHourClockTime);
17+
console.log(twentyFourClockTime);
18+

0 commit comments

Comments
 (0)