JSFiddle - React, Tailwind, and code Playground

JavaScript

month = 'july'; //global variable

function foo(){
    var month = "august"; //private
    console.log(month);
};

function bar(){
    console.log(month); //no local "month", so it looks to the global "month"
};

console.log(month); //in the global scope, month = july

foo(); //in the local scope of the foo function, month = august

bar(); //in the local scope of the bar function, month = july