towerful , 3 months ago Its worth creating an Intl formatter outside of a loop, then applying it inside the loop - if you are formatting everything in the loop the same. const formatter = Intl.NumberFormat(/* options */); return items.map(item => { return { ...item, total: formatter.format(item.total) } }); ...Or however you choose to mutate an array. Well, certainly it used to be. Not sure if that is still the case!
Its worth creating an Intl formatter outside of a loop, then applying it inside the loop - if you are formatting everything in the loop the same.
const formatter = Intl.NumberFormat(/* options */); return items.map(item => { return { ...item, total: formatter.format(item.total) } });
...Or however you choose to mutate an array.
Well, certainly it used to be. Not sure if that is still the case!