Skip to content

Commit f775ea1

Browse files
committed
question answered and error fixed.
1 parent ce0868b commit f775ea1

File tree

1 file changed

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

1 file changed

+12
-0
lines changed

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

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

33
// =============> write your prediction here
4+
/* The function multiply does not return any value, it only logs the product of a and b to the console.
5+
Therefore, when we try to log the result of multiply(10, 32), it will log 'undefined' because the
6+
function does not return anything.*/
47

8+
/*
59
function multiply(a, b) {
610
console.log(a * b);
711
}
812
913
console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);
14+
*/
1015

1116
// =============> write your explanation here
17+
// The function multiply does not have a return statement, so it returns undefined by default.
1218

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+
26+
console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);

0 commit comments

Comments
 (0)