Skip to content

Commit de0d814

Browse files
author
Enice-Codes
committed
completed key errors excercise 2
1 parent 49f8a23 commit de0d814

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

  • Sprint-2/1-key-errors

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,27 @@
11

22
// Predict and explain first BEFORE you run any code...
3+
// i predict that the code will fail because js expects a variable name ,not a number and 3 is a number.
34

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

67
// =============> write your prediction of the error here
8+
// Uncaught SyntaxError: Unexpected number
79

810
function square(3) {
911
return num * num;
1012
}
1113

1214
// =============> write the error message here
15+
//Uncaught SyntaxError: Unexpected number
1316

1417
// =============> explain this error message here
18+
// function parameters must be identifiers (variable names) such num ,x numbers can not be used like variable names
19+
// and so the engine will be unable to read the code and cause synx errorS
1520

16-
// Finally, correct the code to fix the problem
21+
// Finall correct the code to fix the problem
1722

1823
// =============> write your new code here
19-
24+
function square (num){
25+
return num*null;
26+
}
2027

0 commit comments

Comments
 (0)