File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed
Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change 44// this function should square any number but instead we're going to get an error
55
66// =============> write your prediction of the error here
7+ // The code will return a syntax error because the parameter is not a valid variable name as it is a number.
78
8- function square ( 3 ) {
9- return num * num ;
10- }
9+ // function square(3) {
10+ // return num * num;
11+ // }
1112
1213// =============> write the error message here
13-
14+ //SyntaxError: Unexpected number
1415// =============> explain this error message here
15-
16+ //Javascript identifiers cannot start with a number.
1617// Finally, correct the code to fix the problem
1718
1819// =============> write your new code here
1920
21+ function square ( num ) {
22+ return num ** 2 ;
23+ }
24+
25+ console . log ( square ( 3 ) ) ;
2026
You can’t perform that action at this time.
0 commit comments