I have the following object:
events: {
"123" : {}
"1234": {}
}
How can I delete the last X items? for example, in the above example, I would like to delete 2 last items
I know I can use a splice for array but how to do that in an object of objects? thanks
** update ***
I am looking for an efficient way to remove from last and not for each all keys
for example
events: {
"123" : {}
"1234": {}
"333": {}
"444": {}
}
if the number is 2 I will run from the last item and get the 2 objects and will delete them