Skip to content

Commit ef668cc

Browse files
committed
In 2-Mandatory-debug/0.js, predictedwhat the code would return and modified the code
1 parent 45af577 commit ef668cc

File tree

1 file changed

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

1 file changed

+14
-6
lines changed

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

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

3-
// =============> write your prediction here
3+
// =============> In line 6 instead of console.log, I would expect retun a*b; the code will result in
4+
// just printing a*b
45

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

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

11-
// =============> write your explanation here
12+
// =============> After running it returned 320 The result of multiplying 10 and 32 is undefined
13+
// Because the multiply parameters were not taken as paramaters within a retunr.
1214

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

0 commit comments

Comments
 (0)