If I have an array of 3 integers in C#, [1,2,3]
, I can transform that array into another with the .Select
method like so:
[1,2,3].Select(e => new { Id = e, Name = $"name:{e}")
, resulting in a new array with 3 objects.
Is there a way to achieve the same result in JavaScript without using a for loop?