If I have an object like:
{ \'a\' : \'apple\', \'b\' : \'banana\', \'c\' : \'carrot\' }
If I don\'t know in advance that the list goes up
The other answers overcomplicate it for me.
let animals = { a: 'dog', b: 'cat', c: 'bird' } let lastKey = Object.keys(animals).pop() let lastValue = animals[Object.keys(animals).pop()]