JSFiddle - React, Tailwind, and code Playground

by xu xiaofei

JavaScript

Function.prototype.call = function() {
	console.log(arguments)
	console.log(this)
	const foo = this
	const host = arguments[0]
	host.func = foo
	host.func()
}

function foo(name) {
	console.log('my name is' + name + 'this is my gf:' + this.gf)
}

const a = {
	name: 'a',
	gf: 'b'
}

foo.call(a, 'x')