File tree Expand file tree Collapse file tree 1 file changed +6
-15
lines changed
Expand file tree Collapse file tree 1 file changed +6
-15
lines changed Original file line number Diff line number Diff line change 1+
12// Predict and explain first BEFORE you run any code...
23
34// this function should square any number but instead we're going to get an error
45
56// =============> write your prediction of the error here
6- //the function will return square for every given number.
77
8- // function square(3) {
9- // return num * num;
10- // }
8+ function square ( 3 ) {
9+ return num * num ;
10+ }
1111
1212// =============> write the error message here
13- // ans: Unexpected number
1413
1514// =============> explain this error message here
16- // ans: function need num to be defined, instead parameter was given 3 as literal value that does not point to any variable as parameter
17- // Finally, correct the code to fix the problem
18-
19- // =============> write your new code here
2015
21- function square ( num ) {
22- return num * num ;
23- }
24-
25- mynum = 3 ; //define the num
16+ // Finally, correct the code to fix the problem
2617
27- console . log ( square ( mynum ) ) ; //verify the result
18+ // =============> write your new code here
You can’t perform that action at this time.
0 commit comments