underscore.js _.initial[Array]
2012-04-15 22:24
459 查看
initial
Returns everything but the last entry of the array. Especially useful on the arguments object. Pass n to exclude the last n elements from the result.
返回数组的所有元素,最后一个元素除外
源码:
_.initial(array, )
Returns everything but the last entry of the array. Especially useful on the arguments object. Pass n to exclude the last n elements from the result.
返回数组的所有元素,最后一个元素除外
_.initial([5, 4, 3, 2, 1]); => [5, 4, 3, 2]
源码:
_.initial = function(array, n, guard) { return slice.call(array, 0, array.length - ((n == null) || guard ? 1 : n)); };
相关文章推荐
- underscore.js _indexOf[Array]
- underscore.js _.lastIndexOf[Array]
- underscore.js _range[Array]
- underscore.js _.first[Array]
- underscore.js _last[Array]
- underscore.js _reset[Array]
- underscore.js _.flatten[Array]
- underscore.js _without [Array]
- underscore.js _.union[Array]
- underscore.js _.intersect[Array]
- underscore.js _.difference[Array]
- underscore.js _uniq[Array]
- underscore.js _.zip[Array]
- underscore.js的排序扩展。 倒序和多列排序
- Underscore.js与nodejs相结合 - 简单就是美 - ITeye技术网站
- underscorejs-toArray学习
- underscore.js定义模板遇到问题:Uncaught TypeError: Cannot read property 'replace' of undefined
- underscore.js
- moment.js aka underscore.date.js
- Underscore.js 入门