Skip to content

Commit 55f005d

Browse files
2-mandatory-debug 0.jsedited, expectation stated, code fixed
1 parent 3ecd296 commit 55f005d

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

  • Sprint-3/2-mandatory-debug

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

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

3-
// =============> write your prediction here
3+
// =============> console.log in local function will result the product. But console.log in global scope will not call function multiply.
44

5+
//function multiply(a, b) {
6+
// console.log(a * b);
7+
//}
8+
9+
//console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);
10+
11+
// =============> The function multiply does not really carry out the multiplication. It only logs the result of a*b. That's why calling multiply become undefined.
12+
// Finally, correct the code to fix the problem
13+
// =============> write your new code here
514
function multiply(a, b) {
6-
console.log(a * b);
15+
return a * b;
716
}
817

918
console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);
1019

11-
// =============> write your explanation here
12-
13-
// Finally, correct the code to fix the problem
14-
// =============> write your new code here
20+

0 commit comments

Comments
 (0)