Wednesday, September 12, 2018

Javascript reduce note

row.locations = skuLocationsMap[sku].reduce(function (accum, curr) {
    return accum + (accum !== '' ? ', ' : '') + curr;}, '');
The above is a complex way of doing Array.prototype.join() but it's helpful for remembering how reduce works.