I want to sort an object which is associative in terms (key, value) I am able to store the values according to the key, but unable to sort them on the basis of value using in-built sort() functions as in case of associative array.
var usernames = {}; username[1] = "ZNAME"; username[2] = "BNAME"; username[3] = "ANAME"; username[4] = "TNAME"; username[5] = "KNAME"; username[5] = "YNAME"; $.each(usernames,function(key, value){ alert(key + " : " + value); }) Please tell the method to sort with my updated JSFIIDLE