new 的返回值对 new 结果的影响
2019-03-11 本文已影响0人
good__day
function Animal (){
this.name = 'a'
return 1
}
const animal1 = new Animal() // 正常的Animal 实例
function Animal (){
this.name = 'a'
return [1,2,3]
}
const animal1 = new Animal() // [1,2,3]
function Animal (){
this.name = 'a'
return 1
}
const animal1 = new Animal() // 正常的Animal 实例
function Animal (){
this.name = 'a'
return [1,2,3]
}
const animal1 = new Animal() // [1,2,3]