InterviewHubPRO
Section Overview
Q232

Question 232 of 521

Part 4: Prototypes, Object Methods & Event Loop (174 - 253)

45%
JavaScript Internals (521 Qs)•Part 4: Prototypes, Object Methods & Event Loop (174 - 253)

When do you get a syntax error

A SyntaxError is thrown if you try to evaluate code with a syntax error. For example, the below missing quote for the function parameter throws a syntax error

javascript
  try {
    eval("greeting('welcome)"); // Missing ' will produce an error
  } catch (err) {
    console.log(err.name);
  }