Skip to content

Commit de9805d

Browse files
committed
I have updated the explanation.
1 parent 4f46ec2 commit de9805d

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

  • Sprint-2/2-mandatory-debug

Sprint-2/2-mandatory-debug/0.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);
1111

1212
// =============> write your explanation here
1313
//The function multiply(a, b) logs the result but does not return anything.
14+
// The function multiply(a, b) prints the result using console.log(a * b), but it does not return a value. When multiply(10, 32) is called inside the template literal, it first prints 320 to the console. Then, because the function has no return statement, it returns undefined. As a result, the second console.log prints:
1415

16+
//The result of multiplying 10 and 32 is undefined
17+
18+
//This happens because console.log() only displays a value on the screen, while return sends a value back to where the function was called
1519
// Finally, correct the code to fix the problem
1620
// =============> write your new code here
1721
function multiply(a, b) {

0 commit comments

Comments
 (0)