For example:
function foo() { someArray.map(bar) { if (whatever) return; // I want to return from the foo function return bar.something // Here I return to map function } } Here is my current solution:
let flag = false function foo() { someArray.map(bar) { if (whatever){ flag = true } return bar.something // Here I return to map function } } if (flag === true) { return; } I'm wondering if there is a better way?
mapfunction. You can't do that.find, notmap.