File tree Expand file tree Collapse file tree
Sprint-2/2-mandatory-debug Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11// Predict and explain first...
22
3- // =============> write your prediction here
3+ // The result of multiplying 10 and 32 is expected to be undefined because the multiply() function does not return the result.
4+ // It only prints it using console.log().
5+
46
57function multiply ( a , b ) {
68 console . log ( a * b ) ;
79}
810
911console . log ( `The result of multiplying 10 and 32 is ${ multiply ( 10 , 32 ) } ` ) ;
1012
11- // =============> write your explanation here
13+ // After running the code, the result of multiplying 10 and 32 is undefined indeed.
14+ // The problem occurs because the function has no return statement to send a value back to where the function was called.
1215
1316// Finally, correct the code to fix the problem
14- // =============> write your new code here
17+ // function multiply(a, b) {
18+ // return a * b;
19+ // }
20+
21+ // 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