This is the basic JavaScript for loop I'm trying to replace:
for (var i=0; i<tickers.length; i++) {
if (tickers[i].ticker === selectedTicker) {
selectTicker('portfolio', tickers[i]);
break;
}
}
Here is the lodash version
_.times((tickers.length), function() {
if (tickers[i].ticker === selectedTicker) {
selectTicker('portfolio', tickers[i]);
return;
}
});
Obviously this errors out currently, because there is no [i] variable set in the lodash version.
The lodash version is much more readable imho, just do this many times the length of my tickers array.
However I need to compare the ticker of each object to the selectedTicker.
UPDATE: Adding screenshot and link to prove to some asking that _lodash is faster than native Javascript.


_.findand_.filter/Native.filter?