Skip to main content
InterviewHubPRO
Section Overview
Q232

Question 232 of 536

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

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

When do you get a syntax error

junior LevelMost AskedCode ExampleEvent LoopPrototypes

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);
  }