var myclass = function myclass(){
this.field="";
this.method=function(){};
}
myclass.prototype.anothermethod = function(name){
this.name = name;
};
myclass.prototype.another_field = "";
var obj = new myclass();
obj.method();
obj.field;
var class = {
name:"",
methodname:function(){},
}
class.methodname();
匿名函数
(function(){})();
var obj=new Object(); 是使用内置的Object这个函数对象创建实例化对象obj。var obj={};和var obj=[];这种代码将由JS引擎触发Object和Array的构造过程。function fn(){}; var myObj=new fn();是使用用户定义的类型创建实例化对象。
http://www.cnblogs.com/riccc/archive/2008/02/15/javascript-object-model-execution-model.html