I was doing a sorting on my associative array (or object) by value. The sorting works fine but a problem occur when a new pair is added with its key is numeric. For example:
obj = {};
obj["name"] = "John";
obj["15"] = "hi";
obj["add"] = "Texas";
I wanted the output when i use console.log(obj) to be:
{name: "John", 15: "hi", add:"Texas"}
but instead it is:
{15:"hi", name:"John", add:"Texas"}
This ruins my sorting process since any pair with numeric key will be add to the top of the object. Any help is appreciated.