Skip to content

Commit 87b77ed

Browse files
Cleaned up ASI explanation
1 parent c983ebd commit 87b77ed

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

  • Sprint-3/2-mandatory-debug

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);
1111

1212
// =============> write your explanation here
1313
// The return statement was on its own line with nothing after it, so the
14-
// function returned undefined straight away. JavaScript treats the line
15-
// break after return as the end of the statement, so a + b on the next
16-
// line was never reached.
14+
// function returned undefined straight away. This is caused by automatic
15+
// semicolon insertion (ASI), where JavaScript treats the line break after
16+
// 'return' as the end of the statement, so 'a + b' was never reached.
1717
// Finally, correct the code to fix the problem
1818
// =============> write your new code here
1919
// I moved a + b onto the same line as return: return a + b

0 commit comments

Comments
 (0)