Skip to content

Commit e14a4d8

Browse files
committed
submitted completed task
1 parent ce151be commit e14a4d8

File tree

1 file changed

+10
-2
lines changed
  • Sprint-2/2-mandatory-debug

1 file changed

+10
-2
lines changed

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

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

33
// =============> write your prediction here
4-
4+
// The function is not returning the output of its calculation. Therefore, when we try to log the result of the function call, it will return 'undefined'.
5+
/*
56
function multiply(a, b) {
67
console.log(a * b);
78
}
89
910
console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);
10-
11+
*/
1112
// =============> write your explanation here
13+
// 1- The function 'multiply' does not return any value. It only logs the result to the console.
14+
// 2- When 'multiply(10, 32)' is called inside the template literal, it returns 'undefined', so the final output will be "The result of multiplying 10 and 32 is undefined".
1215

1316
// Finally, correct the code to fix the problem
1417
// =============> write your new code here
18+
function multiply(a, b) {
19+
return a * b;
20+
}
21+
22+
console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);

0 commit comments

Comments
 (0)