Skip to content

Commit f91a49c

Browse files
committed
Answering the task
1 parent c642719 commit f91a49c

File tree

1 file changed

+13
-6
lines changed
  • Sprint-2/2-mandatory-debug

1 file changed

+13
-6
lines changed

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

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

3-
// =============> write your prediction here
4+
// =============> In line 6, instead of console.log printing the result of multiply(10, 32), return a*b would be better
5+
//because the console.log would only print a*b.
46

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

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

11-
// =============> write your explanation here
13+
// =============> After running the code, we got 'the result of multiplying 10 and 32 is undefined'
14+
// as the multiply parameters weren't considered as parameters inside the function multiply.
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+
console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);

0 commit comments

Comments
 (0)