File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed
Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change 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
5+ // =============> the code will throw a syntax error because the parameter name '3' is not a valid identifier in JavaScript.
6+ // The error message will likely indicate that there is an unexpected number or that the parameter name is invalid.
77
8- function square ( 3 ) {
9- return num * num ;
10- }
8+ // function square(3) {
9+ // return num * num;
10+ // }
1111
12- // =============> write the error message here
12+ // =============> C:\Users\alexo\CYF\Module-Structuring-and-Testing-Data\Module-Structuring-and-Testing-Data\Sprint-2\
13+ // 1-key-errors\2.js:9 function square(3) {SyntaxError: Unexpected number
1314
14- // =============> explain this error message here
15+ // =============> We get an unexpected number error because the parameter name '3' is not a valid identifier in JavaScript.
1516
1617// Finally, correct the code to fix the problem
1718
1819// =============> write your new code here
1920
21+ function square ( num ) {
22+ return num * num ;
23+ }
2024
25+ console . log ( square ( 4 ) ) ;
You can’t perform that action at this time.
0 commit comments