Answers for "javascript .then .catch .finally"

-1

promise finally in js

let isLoading = true;

fetch(myRequest)
  .then(function(json) { /* process your JSON further */ })
  .catch(function(error) { console.error(error); /* this line can also throw, e.g. when console = {} */ })
  .finally(function() { isLoading = false; });
Posted by: Guest on July-28-2021
0

try catch finally in javascript

try {
  alert( 'try' );
  if (confirm('Make an error?')) BAD_CODE();
} catch (e) {
  alert( 'catch' );
} finally {
  alert( 'finally' );
}
Posted by: Guest on December-01-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language