JSFiddle - React, Tailwind, and code Playground

by tnajdek

JavaScript

(function() {
    var foo = 1;
    function bar() {
        var foo = 2;
    }
    bar();
    console.log(foo) //outputs 1
    if(true) {
        var foo = 3; //redeclares foo
    }
    console.log(foo) //outputs 3
})();