Is there an inexpensive way to flip:
{
"10": "..."
"11": "...",
"12": "...",
"13": "...",
"14": "...",
}
To obtain:
{
"14": "...",
"13": "...",
"12": "..."
"11": "...",
"10": "...",
}
reverse () does not seem to work on json objects. The only way I can think of is to iterate over all the elements and create an array. feels like there should be a better way.
Edit: thanks for the help. UPDATE:
What can I say if each key has historical data. When I use $ .each on an object, it goes through the objects from top to bottom, I did not realize that this is unreliable.
Here is what I am trying to do:
$.each(object, function (key, value) {
function foo (key, value);
});
I want to not run foo on all but the last three pairs, that is, I want to use only the last 3 pairs. I decided if I can cancel them, I can just start the first three and stop.
, 3? 3 , 3. 3 .
.
2:
, , . , , mongodb. .