Skip to content

Commit 9f7a9a0

Browse files
committed
fix early return
1 parent 63539e9 commit 9f7a9a0

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

  • Sprint-3/2-mandatory-debug

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// Predict and explain first...
2-
// =============> write your prediction here
2+
// =====> It will not run and will come out as undefined
33

44
function sum(a, b) {
5-
return;
6-
a + b;
5+
return a + b;
76
}
87

98
console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);
109

11-
// =============> write your explanation here
12-
// Finally, correct the code to fix the problem
10+
// =====> There is a semicolon right after return, which tells it to stop there,
11+
// so basically anything that comes after that will not run hence the undefined result.
12+
// Finally, correct the code to fix the problem will be to remove the semicolon.
1313
// =============> write your new code here

0 commit comments

Comments
 (0)