I have a nested object like this
info ={
"id-1":
{
name: Jane,
age: 35,
experience: "7+",
position: manager,
},
"id-2":
{
age: 38,
name: John,
position: manager,
experience: "9+",
},
"id-3":
{
age: 42,
experience: "12+",
position: manager,
name: Max,
}
and I have a string
let myString ="name, age,position, experience"
I need to access keys in objects (name, age, position, experience) and sort them according to this string, so keys in the object would be in the same order as in myString, like this:
"id-1":
{
name: Jane,
age: 35,
position: manager,
experience: "7+",
},
How can I access keys in the nested objects and sort them in order? When I try to use Object.keys(info) it returns id-1, id-2, id-3 not name, age, position, experience. Please help, I can't seem to figure out a way.