Skip to content

Commit 903614e

Browse files
committed
fix bug in 2-mandatory-debug/0.js
1 parent 57b90cc commit 903614e

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

  • Sprint-2/2-mandatory-debug

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

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

33
// =============> write your prediction here
4+
// Martin response - the function call will return undefined as there is no return value in the multiply function
45

56
function multiply(a, b) {
67
console.log(a * b);
78
}
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

1112
// =============> write your explanation here
13+
// Martin response - the parameters a and b are multiplied and logged inside the function, but there is no return value so the return value from the function is undefined
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)