File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
Expand file tree Collapse file tree 1 file changed +10
-5
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+ // =============> I think that return can only return a value not do a calculation
7+ // so this will return an error because it is trying to do a calculation instead of returning a value
78
89function square ( 3 ) {
910 return num * num ;
1011}
1112
12- // =============> write the error message here
13+ // =============> SyntaxError: Unexpected number
1314
14- // =============> explain this error message here
15+ // =============> this is because variables and parameters in functions cannot start with a number or be a number
16+ // however, return can be used for calculations so my prediction was wrong
1517
1618// Finally, correct the code to fix the problem
1719
18- // =============> write your new code here
19-
20+ // function square (num) {
21+ // return num * num;
22+ // }
23+ // console.log(square(5));
2024
25+ // ran console.log to ensure it works
You can’t perform that action at this time.
0 commit comments