Skip to content

Commit a5bdca3

Browse files
author
Payman IB
committed
Fix sum function to return correct value and update console log
1 parent c8cebbb commit a5bdca3

File tree

1 file changed

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

1 file changed

+12
-6
lines changed

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

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
// Predict and explain first...
22
// =============> write your prediction here
3+
// there is an error on line 5 and 6
4+
//function sum(a, b) {
5+
// //return;
6+
// a + b;
7+
// }
38

4-
function sum(a, b) {
5-
return;
6-
a + b;
7-
}
8-
9-
console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);
9+
// console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);
1010

1111
// =============> write your explanation here
12+
//the return statement is not returning any value. a+b declared after return.
1213
// Finally, correct the code to fix the problem
1314
// =============> write your new code here
15+
function sum(a, b) {
16+
return a + b;
17+
}
18+
19+
console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);

0 commit comments

Comments
 (0)