Skip to content

Commit 84683b4

Browse files
committed
mandatory debug 0.0
1 parent da41579 commit 84683b4

File tree

1 file changed

+11
-6
lines changed
  • Sprint-2/2-mandatory-debug

1 file changed

+11
-6
lines changed

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

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

3-
// =============> write your prediction here
3+
// =============> write your prediction here: There is no return value value for the function multiply. Though it print the value of a * b in the function, this function cannot be called outside of the function (on line 9). So, it will be undefinded. WE need a return
44

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

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

11-
// =============> write your explanation here
11+
// =============> write your explanation here: We need to change console.log on line 6 to return so that we can call in outside of the function.
1212

1313
// Finally, correct the code to fix the problem
1414
// =============> write your new code here
15+
function multiply(a, b) {
16+
return a * b;
17+
}
18+
19+
console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);

0 commit comments

Comments
 (0)