JSFiddle - React, Tailwind, and code Playground

by Trae

JavaScript

/* Five ways to invoke a method */

window.method = method;
function method(){
    console.log("This is: " + typeof this);
    console.log(arguments);
}    

//1
method(1, 2, "test");

//2
window.method(1, 2, "test");

//3

//4
method.apply(window, [1, 2, "test"]);

//5
method.call(window, 1, 2, "test");