JS Coding Questions Logo
JS Coding Questions
#228💼 Interview💻 Code

When do you get a syntax error

Advertisement

728x90

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
1try {
2  eval("greeting('welcome)"); // Missing ' will produce an error
3  } catch (err) {
4  console.log(err.name);
5  }

Advertisement

Responsive Ad
🎯 Practice NowRelated Challenge

JavaScript Coding Exercise 57

Test your knowledge with this interactive coding challenge.

Start Coding

Advertisement

728x90
228of476