File tree Expand file tree Collapse file tree 1 file changed +11
-8
lines changed
Expand file tree Collapse file tree 1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change 11
2- // Predict and explain first BEFORE you run any code.. .
2+ // Predict and explain first BEFORE you run any code: the function is supposed to return the square of the number .
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+ // =============> write your prediction of the error here: Maybe because we used a number instead of a variable inside the function declaration.
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+ // =============> write the error message here : syntax error: Unexpected number (3)
1313
14- // =============> explain this error message here
14+ // =============> explain this error message here: we shouldn't use a number as a parametre name of the function.
1515
1616// Finally, correct the code to fix the problem
1717
1818// =============> write your new code here
19-
19+ function square ( num ) {
20+ return num * num ;
21+ }
22+ console . log ( square ( 3 ) ) ;
2023
You can’t perform that action at this time.
0 commit comments