JSFiddle - React, Tailwind, and code Playground

by iamrohitbanga

JavaScript

var foo = function() {}
foo.prototype.out = function() {
    console.log(this.num);
}
var bar = function() {};
 
var f = new foo();
f.num = 1;
var b = new bar();
b.num = 2;
 
console.log(this);           // 1
f.out();                     // 2
foo.prototype.out.call(b);   // 3
foo.prototype.out.call(bar); // 4