Here is an example of an array:
[{
"first_name": "Anna",
"last_name": "William",
"class": "math",
"year": "1990"
},
{
"first_name": "Tom",
"last_name": "Cruise",
"class": "biology",
"year": "1991"
}
]
I want to convert it into a new array as shown below:
[{
"name": "Anna William",
"class": "math"
},
{
"name": "Tom Cruise",
"class": "biology"
}
]
I could use a loop to achieve this, but it would be lengthy and not very elegant. I am looking for suggestions on how to transform the array using Lodash functions for shorter and more readable code. Any advice would be appreciated!