2012年4月20日
摘要: Return the number of values in thelist.返回元素列表的长度1 _.size({one : 1, two : 2, three : 3});2 => 3源码:1 _.size = function(obj) {2 return _.isArray(obj) ? obj.length : _.keys(obj).length;3 }; 阅读全文
posted @ 2012-04-20 23:28 himanhimao 阅读(164) 评论(0) 推荐(0) 编辑
摘要: Produces a new array of values by mapping each value inlistthrough a transformation function (iterator). If the nativemapmethod exists, it will be used instead. Iflistis a JavaScript object,iterator's arguments will be(value, key, list).所有的javascript对象元素都将经过回调函数作用1 _.map([1, 2, 3], function(num) 阅读全文
posted @ 2012-04-20 23:12 himanhimao 阅读(518) 评论(0) 推荐(0) 编辑
摘要: Iterates over alistof elements, yielding each in turn to aniteratorfunction. Theiteratoris bound to thecontextobject, if one is passed. Each invocation ofiteratoris called with three arguments:(element, index, list). Iflistis a JavaScript object,iterator's arguments will be(value, key, list). De 阅读全文
posted @ 2012-04-20 22:58 himanhimao 阅读(1273) 评论(0) 推荐(0) 编辑