Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

js try without catch

/*
It's possible to have an empty catch block, 
without an error variable, starting with ES2019. 
This is called optional catch binding and was implemented in V8 v6.6, 
released in June 2018. 
The feature has been available since Node 10, Chrome 66, Firefox 58, Opera 53 and Safari 11.1.

The syntax is shown below:
*/
try {
  throw new Error("This won't show anything");
} catch { };

/*

You still need a catch block, but it can be empty and you don't need to pass any variable. 
If you don't want a catch block at all, you can use the try/finally, 
but note that it won't swallow errors as an empty catch does.
*/
try {
  throw new Error("This WILL get logged");
} finally {
  console.log("This syntax does not swallow errors");
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: base64 to base64url javascript 
Javascript :: enhanced object literals in es6 
Javascript :: array reduce javascript 
Javascript :: autocomplete html in react 
Javascript :: new date javascript 
Javascript :: how to make chrome extension js 
Javascript :: string in js 
Javascript :: foreach await js 
Javascript :: js number in range 
Javascript :: AJAX - The XMLHttpRequest Object 
Javascript :: var hoisting.js 
Javascript :: Iterating or loop through the elements of an array is with a for loop (for): 
Javascript :: how to find out what a string ends with in javascript 
Javascript :: simple chat app 
Javascript :: arrow function example 
Javascript :: liquid filter 
Javascript :: json html 
Javascript :: sort array 
Javascript :: get jsonp with fetch 
Javascript :: Angular passing function as component input 
Javascript :: object object js 
Javascript :: vuejs jwt authentication example 
Javascript :: useref initial value 
Javascript :: pm2 change log timestamp 
Javascript :: post nodejs 
Javascript :: project to do with javascript 
Javascript :: discord interaction create not working 
Javascript :: console.log is not a function 
Javascript :: request module nodejs 
Javascript :: passport js npm 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =