I have object like picture below.
I want to use map()
to retrieve the object like
{
"2643216":{pg:1,pt:1},
"1304681":{pg:1,pt:1}
}
Here is my code.
Object.keys(obj).map(function(x){
return {obj[x].number:{'pg':obj[x].pg,'pt':obj[x].pt}}
})
But errors may appear at the obj[x].number
.
The debug errors notifies me the ignorance of the : (colon)
.
Is there mistake I make and any adjustment you can suggest-
or other way can retrieve the object I want?
Thank you.