Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有一个用于下划线的mixin,它有一个takeWhile功能,你可以在这里看到它,在这里(我正在使用这个)。
takeWhile
你怎么用这个?
takeWhile: function(list, callback, context)
你这样用...
var newArr = _.takeWhile([1, 2, 3, 2, 1], function(elem) { return elem < 3; }); // [1, 2]
杰宾。