12
reduce()メソッドを早期に中断する方法は?
reduce()メソッドの反復を中断するにはどうすればよいですか? for: for (var i = Things.length - 1; i >= 0; i--) { if(Things[i] <= 0){ break; } }; reduce() Things.reduce(function(memo, current){ if(current <= 0){ //break ??? //return; <-- this will return undefined to memo, which is not what I want } }, 0)