Javascript Object Sorting
users[usernames] = { userName : username, userId : id, userStatuINT : statu, userMobilemi : mobile, }; Console log : console.log(JSON.strin
Solution 1:
You can't sort properties in an object. Copy the data into an array and sort it.
Example:
var arr = [];
$.each(data, function(key, value){
arr.push({ id: key, data: value });
});
arr.sort(function(x,y){
var xn = x.data.userStatuINT;
var yn = y.data.userStatuINT;
return xn == yn ? 0 : xn < yn ? -1 : 1;
});
Post a Comment for "Javascript Object Sorting"