Javascript Map Array of Objects

Aug 21, 2018
const newResults = results.map(item => {  let name = item.name  if (item.alt_name)    name += ` (${item.alt_name})`  return {    name: name,    address: item.address  }})
const newResults = results.map(item => ({ name: item.name, address: item.address }))

Access index in map function

results.map((item, index) => {})

❤️ Is this article helpful?

Buy me a coffee ☕ or support my work via PayPal to keep this space 🖖 and ad-free.

Do send some 💖 to @d_luaz or share this article.

✨ By Desmond Lua

A dream boy who enjoys making apps, travelling and making youtube videos. Follow me on @d_luaz

👶 Apps I built

Travelopy - discover travel places in Malaysia, Singapore, Taiwan, Japan.