function a(xx){
this.x = xx
return this }
var x = a(5)
var y = a(6)
console.log(x.x) // undefined
console.log(y.x) // 6
收起
实例化对象时要用new调用构造函数。 var x = new a(5) var y = new a(6)
报告相同问题?