Skip to content

Commit ff14721

Browse files
committed
add prediction and explanation
1 parent 54ca144 commit ff14721

File tree

1 file changed

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

1 file changed

+7
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Predict and explain first...
22
// =============> write your prediction here
3+
// I predict it will show a undefined error
34

45
function sum(a, b) {
56
return;
@@ -9,5 +10,11 @@ function sum(a, b) {
910
console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);
1011

1112
// =============> write your explanation here
13+
// The problem was the semicolon after return, which made the function stop before adding the numbers
1214
// Finally, correct the code to fix the problem
1315
// =============> write your new code here
16+
function sum(a, b){
17+
return a + b; // Once I put a + b on the same line as return, it worked
18+
}
19+
20+
console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);

0 commit comments

Comments
 (0)