reference map value in the same map (JavaScript)

I am certain my issue here is not knowing what to call what I’m trying to do here, so any help with that would be appreciated, but I’d like to map over an array and create two values, where the first one refers to the prior value… is that possible?

arr =[1,2,3]
arr.map((el, i) => ({ 
   x: el, 
   y: 5, 
   z: y[i] + 2 // is there a way I can write this so I can refer to y ???
}))

any help appreciated!

34 thoughts on “reference map value in the same map (JavaScript)”

  1. i need loan 2020, i need a loan of 1000 today. need loan but i am not working i need loan need a loan been refused everywhere i need home loan with bad credit, cash advance loans with no credit check, cash advances, cash advance online, 6 month cash advance loans. Bank have acquired commerce, designed for companies.

    Reply

Leave a Comment