JSFiddle - React, Tailwind, and code Playground

by Yogesh Rathod

JavaScript

var x = 0;

function f(){
  var x = 1; // x is declared locally. y is not!
}
f();

alert(x); // 0, 1
//alert(y); // 0, 1
// x is the global one as expected
// y leaked outside of the function, though!