1 var dom = function () {}; 2 dom.Show = function () {alert(‘Show Message‘);}; 3 dom.prototype.Display = function () {alert(‘Property Message‘);}; 4 5 dom.Display(); 6 dom.Show(); 7 var d = new dom(); 8 d.Display(); 9 d.Show();
1 var a = { 2 b: function () { 3 this.say = function () {alert(‘say hello!‘);}; 4 alert("I‘m b"); 5 } 6 };
原文:http://www.cnblogs.com/eulerlcs/p/4371581.html