JSFiddle - React, Tailwind, and code Playground

JavaScript

function f1() {
    this.x = {}; 
    this.x.foo = 0;
    alert(this.x.foo);
    var func = function(val) {
       this.x.foo = val;
    }.bind(this);
    //var bound = func.bind(this);
    func(10);
    alert(this.x.foo);
}
f1();