javascript 對象創建幾種方式

清華大佬耗費三個月吐血整理的幾百G的資源,免費分享!....>>>

/**Object*/
 var obj=new Object;
 obj.name="me";
 obj.action=function(){alert("method");};
 /**構造方法*/
 function construction(){
     this.name="me";
     this.action=function(){alert("method");};
 };
 var obj=new construction();
 /**構造方法call*/
function construction(){
    this.name="me";
    this.action=function(){alert("method");};
  };
 var obj={}; 
 construction.call(obj); 
 /**匿名構造方法call*/
 var obj={};
 (function(){
     this.name="me";
    this.action=function(){alert("method");}; 
 }).call(obj);
 /**單實例構造方法,屬性共享*/
 var obj = function () {};
 obj.prototype.name = 'me';
 obj.prototype.action = function () {
     alert("method");
 }
 var obj1=new obj();