JSFiddle - React, Tailwind, and code Playground

by someprimetime

JavaScript

function globalBobCobb () {
    console.log(this);
}

// this is window
globalBobCobb();

var objectBobCobb = {
    referenceObjectBobCobb : function() {
     console.log(this);   
    }
};
// this is objectBobCobb
objectBobCobb.referenceObjectBobCobb();

var objectBobCobb2 = {
    referenceObjectBobCobb2 : function() {
        console.log(this);
    }
};

// this is forced to be objectBobCobb2
objectBobCobb.referenceObjectBobCobb.apply(objectBobCobb2);