Skip to content

Commit 567077e

Browse files
solving exercise 2.js
1 parent 00fdc77 commit 567077e

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

  • Sprint-3/1-key-errors

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
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-
5+
// =============> write your prediction of the error here : The funcation parameter 3 this will cause an error to be thrown because the parameter is not a valid identifier.
86
function square(3) {
97
return num * num;
8+
109
}
1110

12-
// =============> write the error message here
11+
// =============> write the error message here: SyntaxError: Unexpected number
1312

14-
// =============> explain this error message here
13+
// =============> explain this error message here: SyntaxError: Unexpected number , the parameter 3 is not a valid identifier it should ba valid identifier like num.
1514

1615
// Finally, correct the code to fix the problem
1716

1817
// =============> write your new code here
19-
20-
18+
// function square(num) {
19+
// return num * num;
20+
// }
21+
// console.log(square(3));

0 commit comments

Comments
 (0)