Skip to content

Commit 42ce6cb

Browse files
committed
fix multiply function to return result
1 parent 508504c commit 42ce6cb

File tree

1 file changed

+12
-4
lines changed
  • Sprint-2/2-mandatory-debug

1 file changed

+12
-4
lines changed

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

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
// Predict and explain first...
22

33
// =============> write your prediction here
4+
// When multiply(10, 32) runs, it prints 320, But the function does not return anything.
45

5-
function multiply(a, b) {
6-
console.log(a * b);
7-
}
86

9-
console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);
7+
// function multiply(a, b) {
8+
// console.log(a * b);
9+
// }
10+
11+
// console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);
1012

1113
// =============> write your explanation here
14+
// multiply prints the result but does not return anything, so using it in a template string shows undefined.
1215

1316
// Finally, correct the code to fix the problem
1417
// =============> write your new code here
18+
function multiply(a, b) {
19+
return (a * b)
20+
}
21+
22+
console.log(multiply(10, 32));

0 commit comments

Comments
 (0)