File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 33
44// this function should square any number but instead we're going to get an error
55
6- // =============> write your prediction of the error here
6+ // =============> wrong syntax the number 3 should not be in function
77
88function square ( 3 ) {
99 return num * num ;
1010}
1111
12- // =============> write the error message here
12+ // =============> syntaxError: Unexpected number
1313
14- // =============> explain this error message here
14+ // =============> when defining a function, the parentheses must contain parameter names, not values.
15+ // function square(3) is invalid because 3 is a value, not a parameter name.
1516
1617// Finally, correct the code to fix the problem
1718
18- // =============> write your new code here
19+ // =============>
20+ function square ( num ) { return num * num } ;
21+
22+ console . log ( square ( 3 ) ) ;
1923
2024
You can’t perform that action at this time.
0 commit comments