File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1-
21// Predict and explain first BEFORE you run any code...
32
43// this function should square any number but instead we're going to get an error
54
65// =============> write your prediction of the error here
7-
8- function square ( 3 ) {
6+ //=========Prediction=============
7+ // I think there will not be en error till we call the function.
8+ /*function square(num) {
99 return num * num;
1010}
11-
11+ console.log(square(5))*/
1212// =============> write the error message here
13-
13+ // Unexpected number
1414// =============> explain this error message here
15-
15+ // I think it
1616// Finally, correct the code to fix the problem
17-
17+ // ===========correction=========
18+ // to correct the code we need to introduce parameter as a variable, rather than a number.
19+ // that way any number can be passed when function is called.
1820// =============> write your new code here
19-
20-
21+ function square ( num ) {
22+ return num * num ;
23+ }
24+ console . log ( square ( 5 ) ) ;
You can’t perform that action at this time.
0 commit comments