How can I break out of forEach or re structure my function?
This question already has an answer here:
Use .some()
instead of .forEach()
, and return true
when you want to break.
Or .every()
, and return false
to break.
//...
//WOULD LIKE TO PUT BREAK HERE;
// break;
return;
'return'适合我。
链接地址: http://www.djcxy.com/p/70062.html