-
-
Notifications
You must be signed in to change notification settings - Fork 337
Expand file tree
/
Copy path2.js
More file actions
19 lines (13 loc) · 715 Bytes
/
2.js
File metadata and controls
19 lines (13 loc) · 715 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Predict and explain first BEFORE you run any code...
// this function should square any number but instead we're going to get an error
// =============> The error will be a syntax error. A number is not a valid variable name - variable names cannot start with a number.
function square(3) {
return num * num;
}
// =============> write the error message here: SyntaxError: Unexpected number. The error is because the variable name cannot start with a number.
// =============> explain this error message here: You cannot begin a variable name with a number
// Finally, correct the code to fix the problem
// =============> write your new code here:
// function square(num) {
// return num * num;
// }