Exception handling in javascript
In this article,we are displaing exception handling,try-finally and try-catch-finally are also available. We can throw any value, but features such as stack traces are only supported by Error and its subclasses.
1function throwsException() {
2throw new Error('Problem!');
3}
4function catchesException() {
5try {
6throwsException();
7} catch (err) {
8assert.ok(err instanceof Error);
9assert.equal(err.message, 'Problem!');
10}
11}
About
Moiz is a software engineer from Arid University with a passion for writing tech tutorials and doing coding. I am continously produce JavaScript and other web development technology tutorials in concepts through easy-to-understand explanations written in plain English.I have expertise in next js ,react js ,javascript,html,bootstrap and node js.
Follow him on TwitterHassan is a software engineer from kohat university of science and technology with a passion for writing tech tutorials and doing javascript practices on daily basis.I have expertise in next js ,react js ,javascript,html,bootstrap and node js. Problem Solving and making concpets is my strong point.
Follow him on TwitterTags
Click to see all tutorials tagged with: