Lets say i have an array of objects:
let movies = [
{
"title": "Last Flag Flying",
"year": 2017,
"cast": ["Steve Carell","Bryan Cranston"],
"genres": ["Comedy","Drama"],
"id": 1
},
{
"title": "Lady Bird",
"year": 2017,
"cast": ["Saoirse Ronan","Laurie Metcalf","Tracy Letts"],
"genres": ["Comedy","Drama"],
"id": 2
},
];
I want to move the last property id
to the first index. I mean each of the object should start with {"id": ...}
Any help would be appreciated