Skip to content

Commit 503eb4f

Browse files
committed
Re-answering the explation part
1 parent a5b3bee commit 503eb4f

File tree

1 file changed

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

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Predict and explain first...
2-
// =============> write your prediction here : A syntax error for the semicolon after return.
2+
// =============> write your prediction here : There will be an error in return line.
33

44
function sum(a, b) {
55
return;
@@ -8,7 +8,7 @@ function sum(a, b) {
88

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

11-
// =============> write your explanation here : The semicolon after return end the statement. So there will be no value returned from the function.
11+
// =============> write your explanation here : The return statement ends the function immediately. Since there is a line break after return, JavaScript automatically inserts a semicolon, so the function returns undefined and the expression a + b is never executed.
1212

1313
// Finally, correct the code to fix the problem
1414
// =============> write your new code here

0 commit comments

Comments
 (0)