Skip to content

Commit ccf9b9b

Browse files
committed
Fixed multiply function to return correct output
1 parent b4435a7 commit ccf9b9b

File tree

1 file changed

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

1 file changed

+9
-6
lines changed

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

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

33
// =============> write your prediction here
4-
5-
function multiply(a, b) {
6-
console.log(a * b);
7-
}
8-
9-
console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);
4+
// in console.log we should just write (multiply(10,32) because writing in plain english will give us an error,
5+
// and it won't give the output.
106

117
// =============> write your explanation here
8+
// the code was broken because the console.log was inside the function it not a function,
9+
//by using the return it gives us the correct output.
1210

1311
// Finally, correct the code to fix the problem
1412
// =============> write your new code here
13+
function multiply(a, b) {
14+
return (a * b)
15+
}
16+
17+
console.log(multiply(10, 32));

0 commit comments

Comments
 (0)