Advertisement
728x90
The EvalError object indicates an error regarding the global eval() function. Even though this exception is not thrown by JavaScript anymore, the EvalError object remains for compatibility. The syntax of this expression would be as below,
javascript
1new EvalError([message[, fileName[, lineNumber]]])You can throw EvalError with in try...catch block as below,
javascript
1try {
2 throw new EvalError('Eval function error', 'someFile.js', 100);
3 } catch (e) {
4 console.log(e.message, e.name, e.fileName); // "Eval function error", "EvalError", "someFile.js"Advertisement
Responsive Ad
🎯 Practice NowRelated Challenge
JavaScript Coding Exercise 83
Test your knowledge with this interactive coding challenge.
Start CodingAdvertisement
728x90
340of476