I have this javascript object children with multiple array inside and the array names are random.
how can i loop through it without specifying ‘S801’, ‘S901’ etc so i can get some result like
[52.4655012, 13.2595648], [21.1006158, 79.0074763] , ……
>Solution :
Use Object.values to get the values in the Object and then map over it.
const obj = {
children: {
S801: [52, 13],
S901: [21, 79]
}
};
Object.values(obj.children).map(([value1,value2]) => {
console.log(value1,value2)
})
