JSFiddle - React, Tailwind, and code Playground

by Deepak Anand

JavaScript

// Block scoping example with try-catch 

try{
  throw "exception";  
}catch(ex){
  var a = 3;
}
// The variable 'a' is not block-scoped to the catch block.
// If if it did, the following code should have printed undefined
// The block scoping rule applies only to the exception variable in this example 'ex'
console.log(a); //3