I have an array that is about 1000 in length. Why is map function returning undefined in certain indexes? Is there a way to only return array that meets this condition? I'd like to return an array with values > 0.
var total_percents = cars.map(function(element) {
var savings_percent = Number(element[0].getAttribute("percent-savings"));
if (savings_percent > 0)
return savings_percent;
});