Skip to content

Commit fc492bb

Browse files
committed
Fix multiply function to return the result and update predictions and explanations
1 parent b857592 commit fc492bb

File tree

1 file changed

+12
-1
lines changed
  • Sprint-2/2-mandatory-debug

1 file changed

+12
-1
lines changed

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

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

3-
// =============> write your prediction here
3+
// I predict that the code will output the result of the multiplication, but the function multiply will not return a value.
4+
5+
// this function should multiply two numbers and return the result
6+
47

58
function multiply(a, b) {
69
console.log(a * b);
@@ -10,5 +13,13 @@ console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);
1013

1114
// =============> write your explanation here
1215

16+
// The function multiply is using console.log to output the result of the multiplication, but it is not returning a value.
17+
// Therefore, the template literal will not be able to access the result of the multiplication.
18+
1319
// Finally, correct the code to fix the problem
1420
// =============> write your new code here
21+
22+
function multiply(a, b) {
23+
return a * b;
24+
}
25+
console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);

0 commit comments

Comments
 (0)