Skip to content

Commit b02c2d9

Browse files
committed
Sprint-2, 2-mandatory-debug, 0.js done
1 parent 440f0f1 commit b02c2d9

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,6 +1,9 @@
11
// Predict and explain first...
22

33
// =============> write your prediction here
4+
// The function multiply does not return anything, it only logs the result to the console.
5+
// Therefore the outcome of the final console.log will be undefined
6+
47

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

1114
// =============> write your explanation here
15+
// The function multiply does not return a value, it only logs the result to the console.
16+
// Therefore on using the template literal to write the result of the function, it doesn't
17+
// have one and renders "undefined" instead
18+
1219

1320
// Finally, correct the code to fix the problem
1421
// =============> 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)