There was an error while loading. Please reload this page.
1 parent e7b50d9 commit 65cb89cCopy full SHA for 65cb89c
1 file changed
Sprint-3/2-mandatory-debug/0.js
@@ -1,14 +1,13 @@
1
// Predict and explain first...
2
-
3
-// =============> write your prediction here
+// Prediction: multiply logs 320 but returns undefined, so the template
+// string prints: "The result of multiplying 10 and 32 is undefined"
4
5
function multiply(a, b) {
6
- console.log(a * b);
+ return a * b;
7
}
8
9
console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);
10
11
-// =============> write your explanation here
12
13
-// Finally, correct the code to fix the problem
14
-// =============> write your new code here
+// Explanation: console.log inside a function only prints; it does not return
+// a value. Without return, the function result is undefined. Using return
+// gives 320 so the template string shows the correct message.
0 commit comments