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
2019
2120// =============> write your new code here
2221function square ( num ) {
23- return num * num ;
22+ return num * num ;
2423}
2524
26- console . log ( square ( 3 ) )
25+ console . log ( square ( 3 ) ) ;
Original file line number Diff line number Diff line change 11// Predict and explain first...
22
33// =============> write your prediction here
4+ // local scope code did not return to global.
45
5- function multiply ( a , b ) {
6- console . log ( a * b ) ;
7- }
6+ // function multiply(a, b) {
7+ // console.log(a * b);
8+ // }
89
9- console . log ( `The result of multiplying 10 and 32 is ${ multiply ( 10 , 32 ) } ` ) ;
10+ // console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);
1011
1112// =============> write your explanation here
13+ // The calculation of the a * b should apply the the statement (`The result of multiplying 10 and 32 is ${multiply(10, 32)}`).
14+ // because code on local scope did not return to global. The global cannot apply the result of local.
1215
1316// Finally, correct the code to fix the problem
1417// =============> write your new code here
18+
19+ function multiply ( a , b ) {
20+ return a * b ;
21+ }
22+
23+ console . log ( `The result of multiplying 10 and 32 is ${ multiply ( 10 , 32 ) } ` ) ;
You can’t perform that action at this time.
0 commit comments