JSFiddle - React, Tailwind, and code Playground

HTML

<a href="#" id="change-html">Change HTML</a>

JavaScript

var btn = $('#change-html');
btn.click(bindClick(btn));
var inside = "i'm outside a closure";
console.log(inside);
function bindClick(source){
    var inside = "i'm inside a closure";
    return function() {
        console.log(inside);
    }
    
}