JSFiddle - React, Tailwind, and code Playground
JavaScript
var mainObj = {
person: 'John',
print: function(val1, val2, val3) {
console.log(val1, val2, val3);
console.log(this.person);
}
}
var arr = [1, 2, 3];
mainObj.print.apply(mainObj, arr);
// In non-strict mode, when null is the first argument for apply(), then the default global value will be used for this.
console.log(Math.max.apply(null, arr));
console.log(Math.min.apply(null, arr));