JSFiddle - React, Tailwind, and code Playground

by dmitri_pavlutin

JavaScript

function isTruthy(value) {
  if (value) {
    /**
     * temporal dead zone for myVariable
     */
    // Throws ReferenceError: myVariable is not defined
    console.log(myVariable);
    let myVariable = 'Value 2';
    // end of temporary dead zone for myVariable
    console.log(myVariable); // => 'Value 2'
    return true;
  }
  return false;
}

isTruthy(1)