FrontendDeveloper.in

JavaScript Track Detail

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

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