Skip to content

Commit b51c2c4

Browse files
change console to return
1 parent 3e44896 commit b51c2c4

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

  • Sprint-3/2-mandatory-debug

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

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
11
// Predict and explain first...
2-
32
// =============> write your prediction here
3+
//when we run the code, I predict that the function just execute but doesn't return any thing.
4+
// function just print the result of multiply
5+
// I am not sure what going to be show in the second console.log
46

5-
function multiply(a, b) {
7+
/*function multiply(a, b) {
68
console.log(a * b);
79
}
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

1113
// =============> write your explanation here
14+
// After running the code, the multiply function display the result (320)
15+
// but it does not return result back to the code
16+
// therefore, multiply(10, 32) evaluate undefined
1217

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

0 commit comments

Comments
 (0)