怎么知道函数被new了

89 阅读1分钟
function Foo() {
	if(!this instanceof Foo) {
    	console.log('被new了')
    }
}