Skip to content

Commit 409baf9

Browse files
committed
Add explanation for SyntaxError in square function parameter
1 parent ca723f9 commit 409baf9

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

  • Sprint-3/1-key-errors

‎Sprint-3/1-key-errors/2.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ function square(3) {
1414
// SyntaxError: Unexpected number
1515

1616
// =============> explain this error message here
17+
// In the 'function square(3)' JavaScript parser expected a valid parameter name it could use as a variable
18+
// Since '3' is a number literal, not a valid identifier, the parser cannot understand it and throws a syntax error.
1719

1820
// Finally, correct the code to fix the problem
1921

0 commit comments

Comments
 (0)