Skip to content

Commit 7183aac

Browse files
committed
completed tasks in 2-mandatory-debug/0.js
1 parent 060813b commit 7183aac

File tree

1 file changed

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

1 file changed

+12
-5
lines changed

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

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

33
// =============> write your prediction here
4+
// When the code is run the product of a and b will be logged to the console however the console log portion that relates to the function call will show undefined because the function doesn't return anything
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+
// As the function has no return statement it returns undefined by default.
1314
// Finally, correct the code to fix the problem
1415
// =============> write your new code here
16+
17+
function multiply(a, b) {
18+
return a * b;
19+
}
20+
21+
console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);

0 commit comments

Comments
 (0)