Skip to content

Commit b286998

Browse files
committed
Finished Key error 2
1 parent 0f18c37 commit b286998

File tree

1 file changed

+7
-8
lines changed
  • Sprint-2/1-key-errors

1 file changed

+7
-8
lines changed

Sprint-2/1-key-errors/2.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11

22
// Predict and explain first BEFORE you run any code...
3-
43
// this function should square any number but instead we're going to get an error
5-
6-
// =============> write your prediction of the error here
4+
// =============> The error will be a syntax error. A number is not a valid variable name - variable names cannot start with a number.
75

86
function square(3) {
97
return num * num;
108
}
119

12-
// =============> write the error message here
10+
// =============> write the error message here: SyntaxError: Unexpected number. The error is because the variable name cannot start with a number.
1311

14-
// =============> explain this error message here
12+
// =============> explain this error message here: You cannot begin a variable name with a number
1513

1614
// Finally, correct the code to fix the problem
1715

18-
// =============> write your new code here
19-
20-
16+
// =============> write your new code here:
17+
// function square(num) {
18+
// return num * num;
19+
// }

0 commit comments

Comments
 (0)