摘要: var num=7;switch(true){case num = 0 && num<= 10: alert("between 0 and 10"); break;default: alert("more than 10");}switch语句在比较值时使用的是全等操作符,因此不会发生类型转换。在s... 阅读全文
posted @ 2014-08-09 16:44 丁元新 阅读(267) 评论(0) 推荐(0) 编辑
摘要: 转载自:http://www.cnblogs.com/TomXu/archive/2011/12/28/2286877.html扩增构造函数的prototype属性是个很强大的增加功能的方法,但有时候它太强大了。增加内置的构造函数原型(如Object(), Array(), 或Function())... 阅读全文
posted @ 2014-08-09 15:41 丁元新 阅读(276) 评论(0) 推荐(0) 编辑
摘要: 转载自:http://www.cnblogs.com/TomXu/archive/2011/12/28/2286877.html有个很重要的hasOwnProperty()方法,当遍历对象属性的时候可以过滤掉从原型链上下来的属性。// 对象var man = { hands: 2, legs... 阅读全文
posted @ 2014-08-09 14:43 丁元新 阅读(227) 评论(0) 推荐(0) 编辑
摘要: 转载自:http://www.cnblogs.com/TomXu/archive/2011/12/28/2286877.htmlfunction looper() { var i = 0, max, myarray = []; // ... for (i = ... 阅读全文
posted @ 2014-08-09 11:27 丁元新 阅读(136) 评论(0) 推荐(0) 编辑
Top