Skip to content

Commit 7fadd53

Browse files
committed
fix the bug in 2-mandatory-debug/1.js
1 parent 903614e commit 7fadd53

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

  • Sprint-2/2-mandatory-debug

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
// Predict and explain first...
22
// =============> write your prediction here
3+
// Martin response - I expect this to return a blank value as there is a return statement, with no expression;
34

45
function sum(a, b) {
56
return;
67
a + b;
78
}
89

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

1112
// =============> write your explanation here
13+
// Martin response - the value returned is undefined because the return statement is return with no expression;
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)