JSFiddle - React, Tailwind, and code Playground

JavaScript

var i = 1;
var fn = function() { // this closure maintains a reference to i 
    alert(i); 
};
i = 10; // such that when we change i's value here
fn.call(); // it's reflected by the function call