Skip to content

Commit 985cde4

Browse files
committed
0.js committed
1 parent 4542624 commit 985cde4

File tree

1 file changed

+19
-0
lines changed
  • Sprint-2/2-mandatory-debug

1 file changed

+19
-0
lines changed

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

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

33
// =============> write your prediction here
4+
/**
5+
* It display "320" and "The result of multiplying 10 and 32 is undefined"
6+
*/
47

8+
/**
59
function multiply(a, b) {
610
console.log(a * b);
711
}
812
913
console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);
14+
*/
1015

1116
// =============> write your explanation here
1217

18+
/** Explanation:
19+
*
20+
* The following function takes two arguments a and b as input and display the multiplication result.
21+
* But instead of using the function "console.log" it shoudl use the function "return (a * b)".
22+
* That's the reason it displays "undefined".
23+
*/
24+
1325
// Finally, correct the code to fix the problem
1426
// =============> write your new code here
27+
28+
function multiply(a, b) {
29+
return a * b;
30+
}
31+
32+
console.log(`The result of multiplying 10 and 32 is ${multiply(10, 32)}`);
33+

0 commit comments

Comments
 (0)