11
you are viewing a single comment's thread
view the rest of the comments
[-] towerful@programming.dev 6 points 5 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!

this post was submitted on 05 Apr 2024
11 points (92.3% liked)

Web Development

3427 readers
1 users here now

Welcome to the web development community! This is a place to post, discuss, get help about, etc. anything related to web development

What is web development?

Web development is the process of creating websites or web applications

Rules/Guidelines

Related Communities

Wormhole

Some webdev blogsNot sure what to post in here? Want some web development related things to read?

Heres a couple blogs that have web development related content

CreditsIcon base by Delapouite under CC BY 3.0 with modifications to add a gradient

founded 1 year ago
MODERATORS