function Demo(){
this.fn=function(){
console.log(1)
}
}
Demo.fn=function(){
console.log(2)
}
Demo.prototype.fn=function(){console.log(3)}
function fn(){
console.log(4)
}
var fn=function(){
console.log(5)
}
// Demo.fn()//2
// Demo.fn//不执行
// Demo().fn()//报错
// console.log(Demo.fn())
/*
2
undefined
*/
// console.log(Demo.fn)
/*
ƒ (){
console.log(2)
}
*/
// console.log(Demo().fn())
/*
Uncaught TypeError: Cannot read properties of undefined (reading 'fn')
*/
// new Demo().fn()//1
// new new Demo().fn()//1
// new Demo.fn()//2
// new new Demo.fn()
/*
2
Uncaught TypeError: (intermediate value) is not a constructor
*/
// console.log(new Demo().fn())
/*
1
undefined
*/
// console.log(new new Demo().fn())
/*
1
Demo.fn()
*/
// console.log(new Demo.fn())
/*
2
Demo.fn()
*/
// console.log(new new Demo.fn())
/*
2
报错
*/
// fn()//5