Skip to content

Commit a4f1b8e

Browse files
fix: update comments to clarify function behavior and implement return in multiply function
1 parent f2c1b80 commit a4f1b8e

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

  • Sprint-3/2-mandatory-debug

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

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

3-
// =============> write your prediction here
3+
// There is no return in the function, the wrong use of console.log is being used, therefore the function isn't being closed and only is the console.log being logged twice, causing the function's parameters to be defined by the 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+
// The instead of console.log being used in the functions expression, there should be a return.
1212

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

0 commit comments

Comments
 (0)