javascript basic concept.....[@more@]Instance property: property defined in constructor:function Circle(radius) {this.ra
javascript basic concept.....
[@more@]function Circle(radius) {this.radius = radius;}
Circle.PI = 3.141592;Circle.UNIT = new Circle(1);
Circle.prototype.area() { // notes: must explicitly specify thiskeyWord to propertyreturn Circle.PI * this.radius * this.radius;}
Circle.max = function (a,b) {if (a.r > b.r) {return a;}else {return b;}}
uniqueID = function(){ // user can set id back to 0 by: uniqueID.id = 0 if (!arguments.callee.id) arguments.callee.id = 0; return arguments.callee.id++;};uid = (function(){ // closure, id is persistent and private var id = 0; return function(){ return id++; };})();var ret = "";var i = 10;while (i--) { ret += uniqueID() + "t"; uniqueID.id = 0;}alert(ret);i = 10;ret = "";while (i--) { ret += uid() + "t";}alert(ret);
--结束END--
本文标题: Javascript Study Memo
本文链接: https://lsjlt.com/news/232068.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
2024-05-24
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0