I'm having problems getting the result for 'newestLine' out of the array map function.
The first console.log
gives the correct result the second two gives undefined.
var currentArr = [+1+SN5M+K114987A+ZO1075892+ICRR+191009+000000+GU345HB+EC2419+1 ITEMS, +1+SN5M+K114987A+ZO1075892+I139+191009+151600+COVENTRY DEPOT+EC2419+1 ITEMS, +1+SN5M+K114987A+ZO1075892+ISCN+191009+151600+GU345HB+EC2419+1 ITEMS]
currentArr.map(function(obj) {
if (obj.split('+')[7] > maxid) {
maxid = obj.split('+')[7];
var newestLine = obj;
console.log(newestLine);
return newestLine;
}
console.log(newestLine);
return newestLine;
});
console.log(newestLine);