Skip to content

Commit 9cad53a

Browse files
committed
debug 0.js in Sprint 2 > 2-mandatory-debug
1 parent 72f37f5 commit 9cad53a

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

  • Sprint-2/2-mandatory-debug

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

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

3-
// =============> write your prediction here
3+
// =============> the function is not returning anything, it just logs to the console.
44

55
function multiply(a, b) {
66
console.log(a * b);
77
}
88

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

11-
// =============> write your explanation here
11+
// =============> write your explanation here:
12+
// 320
13+
// The result of multiplying 10 and 32 is undefined
14+
// it prints the result of 10*32 since we called the function in our last console log, then it prints the sentence, but the sentence would include the return value of the function, but that is undefined, as the function did not return any value.
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+
console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);

0 commit comments

Comments
 (0)