有没有理由在javascripts中使用公共属性?
当我们比较时,
funtion A() {
this.a = 'lol'; //public proeprty. it will use memory space per object. right?
}
function B() {
}
B.prototype.b ='lol'; //prototype property. it will share same memory address until new value is setted. right?
for(var i = 0; i < 10; i++) { aa[i] = new A(); bb[i] = new B(); }
B的实现在内存中非常有效,并且可访问性没有区别。那么,有没有理由使用公共财产?