JavaScript:初始化属性的最佳方法? [关闭]

对JavaScript而言相对较新(来自Java世界),我想知道初始化属性的最佳方法吗?

Person = function(pName) {
   this.name = pName || null; //"Java Like"

OR

   this.name = pName; //sets to undefined if object created without argument
}


评论