Skip to content

Commit 9c61083

Browse files
debug2604debug2604
authored andcommitted
2.js SyntaxError expected, explained the error, wrote new code, deleted old code
1 parent 41e9a7a commit 9c61083

1 file changed

Lines changed: 7 additions & 10 deletions

File tree

  • Sprint-3/1-key-errors

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

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
1-
21
// Predict and explain first BEFORE you run any code...
32

43
// this function should square any number but instead we're going to get an error
54

6-
// =============> write your prediction of the error here
7-
8-
function square(3) {
9-
return num * num;
10-
}
5+
// =============> I expect SyntaxError will result
116

12-
// =============> write the error message here
7+
// =============> SyntaxError: Unexpected number
138

14-
// =============> explain this error message here
9+
// =============> Numerical character "3" cannot be named as parameter of a function.
1510

1611
// Finally, correct the code to fix the problem
1712

1813
// =============> write your new code here
19-
20-
14+
function square(num) {
15+
return num * num;
16+
}
17+
console.log(square(3));

0 commit comments

Comments
 (0)