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
33// =============> write your prediction here
4+ //I think this code will not show the correct result because the function logs the answer instead of returning it.
45
5- function multiply ( a , b ) {
6+ /* function multiply(a, b) {
67 console.log(a * b);
78}
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+ /*First, the function multiplies 10 and 32 and prints the result. However, in the second console.log
14+ the value becomes undefined because the function does not return anything, so the template string
15+ receives undefined instead of the number.*/
1216
1317// Finally, correct the code to fix the problem
1418// =============> write your new code here
19+ function multiply ( a , b ) {
20+ return a * b ;
21+ }
22+ 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