I am trying to find a way to get an array of objects from a normal array without using a for loop.
An example for that I want to turn that array:
[1,2,3,4,5]
To be an array of objects like that:
[{x:1, y:2}, {x:2, y:4}, {x:3, y:6}, {x:4, y:8}, {x:5, y:10}]
without using a for loop
Mureinik
316k54 gold badges403 silver badges406 bronze badges
lang-js
[1,2,3,4,5]but you want to "transform" that into an array of objects that have other elements that are not present in your initial array like6,8,10so what kind of rule are you even following to create your array?