JSFiddle - React, Tailwind, and code Playground

by spechackers

JavaScript

function myFunction(){console.log(this)};
myFunction(); // this refers to global.

var newObj = {};
myFunction.call(newObj); // this refers to newObj
myFunction.apply(newObj); // this refers to newObj
var newFn = myFunction.bind(newObj);
newFn();