I have the following loop in javascript array A
[
{
"key1": "value121212",
"booleankey": false,
},
{
"key1": "value143434",
"booleankey": false,
},
{
"key1": "value1454545",
"booleankey": true,
}
]
I need to loop the above array A and create another array B which includes booleankey
,
Requirement is, when i create the new array B, the entry with "booleankey": true,
should come first. Initial array A can have the booleankey as true as the last entry,
How can i make sure to get the new array B with booleankey true always on the first ? This is how arrayB is created:
createArrayB(entry) {
arrayA.map((entry) => {
return {
newkey: entry.key1,
newbooleankey: entry.booleankey,
}
});