Skip to content

Commit 1fb3330

Browse files
authored
Fix multiply function to return correct value
Added return statement to the multiply function to ensure it returns the product of the two numbers.
1 parent 485314b commit 1fb3330

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

  • Sprint-2/2-mandatory-debug

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,15 @@ function multiply(a, b) {
88

99
console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);
1010

11+
// [ChunYanWong]
12+
//320
13+
//The result of multiplying 10 and 32 is undefined
14+
1115
// =============> write your explanation here
16+
// [ChunYanWong] The program can be executed but no return statement in the function and hence no value is returned.
1217

1318
// Finally, correct the code to fix the problem
1419
// =============> write your new code here
20+
// [ChunYanWong]
21+
// console.log(a * b);
22+
// return (a * b)

0 commit comments

Comments
 (0)