2014年9月10日

摘要: 1、注意一下几段代码:sayHi();function sayHi() { alert("Hi!");}sayHi(); //错误:函数还不存在var sayHi = function () { alert("Hi!");};//不要这样做!if (condition) { fun... 阅读全文

posted @ 2014-09-10 23:34 liguwe 阅读(142) 评论(0) 推荐(0) 编辑

摘要: 1、访问器属性:var book = { _year: 2004, edition: 1};Object.defineProperty(book, "year", { get: function(){ return this._year; }, set: function(new... 阅读全文

posted @ 2014-09-10 23:27 liguwe 阅读(147) 评论(0) 推荐(0) 编辑

摘要: 1、工厂函数function range(from, to) { var r = inherit(range.methods); r.from = from; r.to = to; return r;};range.methods = { includes: funct... 阅读全文

posted @ 2014-09-10 21:24 liguwe 阅读(309) 评论(0) 推荐(0) 编辑

摘要: 1、非贪婪的重复:如"??" 、 "+?" 、 "*?" 、"{1,5}?" 例如: 非贪婪匹配 /a+?/去匹配aaa,尽可能的少匹配,只能匹配到第一个a, /a+/去匹配aaa,匹配到了aaa /a+b/去匹配aabb,匹配到aabb 而使用非贪婪匹配/a+?b... 阅读全文

posted @ 2014-09-10 17:37 liguwe 阅读(204) 评论(0) 推荐(0) 编辑

摘要: 8.1 函数定义: 变量声明提前,但是变量赋值并不会提前 函数声明语句不能出现在循环,条件判断或者try/catch/finally以及with语句中:8.2 函数调用(函数调用,方法调用,构造函数调用,间接调用(call,apply)) 1、var isStrict = (function(... 阅读全文

posted @ 2014-09-10 11:18 liguwe 阅读(191) 评论(0) 推荐(0) 编辑