JSFiddle - React, Tailwind, and code Playground

HTML

<div id="thediv">
    Test
</div>

CSS

#thediv {
  width: 200px;
  height: 200px;
  background-color: red;  
}

JavaScript

var i = 0;
    function test() {
        var _this = this;
        // foo and _this.foo are set to the same number

        var foo = _this.foo = i++;

        function wtf() {
            console.log(_this, this, _this.foo, foo, i);
        }

        $("#thediv").click(wtf);
    };

    test();
    test();
    test();