File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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
810function 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
You can’t perform that action at this time.
0 commit comments