Skip to content

Commit 33f9efb

Browse files
committed
Refactor multiply function to return the product and update console log accordingly
1 parent 329939a commit 33f9efb

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

  • Sprint-3/2-mandatory-debug

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
// My prediction is '320' would be printed first followed by "The result of multiplying 10 and 32 is undefined"
55
// This occurs because 'multiply()' does not return anything
66

7-
function multiply(a, b) {
8-
console.log(a * b);
9-
}
7+
// function multiply(a, b) {
8+
// console.log(a * b);
9+
// }
1010

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

1313
// =============> write your explanation here
1414
// The template literal calls 'multiply(10, 32) to build the string
@@ -19,3 +19,8 @@ console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);
1919

2020
// Finally, correct the code to fix the problem
2121
// =============> write your new code here
22+
function multiply(a, b){
23+
return a * b;
24+
}
25+
26+
console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);

0 commit comments

Comments
 (0)