how to break the _.each function in underscore.js

后端 未结 11 1861
闹比i
闹比i 2020-11-28 20:49

I\'m looking for a way to stop iterations of underscore.js _.each() method, but can\'t find the solution. jQuery .each() can break if you do

11条回答
  •  [愿得一人]
    2020-11-28 21:34

    worked in my case

    var arr2 = _.filter(arr, function(item){
        if ( item == 3 ) return item;
    });
    

提交回复
热议问题