Skip to content

Commit 8486d54

Browse files
committed
fix sum function to return correct value
1 parent 42ce6cb commit 8486d54

File tree

1 file changed

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

1 file changed

+13
-5
lines changed

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

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
// Predict and explain first...
22
// =============> write your prediction here
3+
// The function sum does not return anything,
4+
// so the console will show "The sum of 10 and 32 is undefined".
35

4-
function sum(a, b) {
5-
return;
6-
a + b;
7-
}
6+
// function sum(a, b) {
7+
// return
8+
// a + b;
9+
// }
810

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

1113
// =============> write your explanation here
1214
// Finally, correct the code to fix the problem
1315
// =============> write your new code here
16+
17+
function sum(a, b) {
18+
return (a+b);
19+
}
20+
21+
console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);

0 commit comments

Comments
 (0)