Skip to content

Commit df1dd85

Browse files
committed
evaluated the program in 0.js
1 parent c14ac01 commit df1dd85

File tree

1 file changed

+11
-5
lines changed
  • Sprint-2/2-mandatory-debug

1 file changed

+11
-5
lines changed

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

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

33
// =============> write your prediction here
4+
// This function only logs the evaluation and would compile as undefined when called
45

5-
function multiply(a, b) {
6-
console.log(a * b);
7-
}
6+
// function multiply(a, b) {
7+
// console.log(a * b);
8+
// }
89

9-
console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);
10+
// console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);
1011

1112
// =============> write your explanation here
12-
13+
// The function does not have a return statement, it only logs the evaluation inside the function, but calling the function without a return statement would not return the evaluation. it would return undefined
1314
// Finally, correct the code to fix the problem
1415
// =============> write your new code here
16+
function multiply(a, b) {
17+
return a * b;
18+
}
19+
20+
console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);

0 commit comments

Comments
 (0)