My question, what is the best way to get all the last values from javascript object. Example: Given any object (Must accept any object), but for an example:
const obj = {
"id": 1,
"name": "Leanne Graham",
"address": {
"street": "Kulas Light",
"geo": {
"lat": "-37.3159",
}
}
}
And have a function to get all the last values:
console.log( getAllLastValues(obj) );
And the expected result is:
{
"id": 1,
"name": "Leanne Graham",
"street": "Kulas Light",
"lat": "-37.3159"
}