var list = {"you": 100, "me": 75, "foo": 116, "bar": 15};
keysSorted = Object.keys(list).sort(function(a,b){return list[a]-list[b]})
alert(keysSorted); // bar,me,you,foo
from Sorting JavaScript Object by property value
I'm doing Object sorting. Above source working in Javascript. But not working in Node.js. I have an error like this.
keysSorted = Object.keys(list).sort(function(a,b){return list[a]-list[b]})
^
TypeError: Object.keys is not a function
I don't know why. Please help me.
node -vshow?Objectsomewhere? likevar Object = 'something else';? Not sure how Node would react to that but seeingTypeError: Object.keys is not a functionleaves me just that option...6.2.2and you can actually dovar Object = 'something else';and erase the Object native value.... can that be your problem? Check your variables...var Object = 'requrie file';. Thank u so much guys. You're genius.