As others have pointed out in comments, an object's properties cannot be sorted. What you could do instead, is produce a sorted array of the objects properties, and iterate that array to access the objects properties in the order you wish. You basically already did this in your example code - you just tried to take it a step too far.
function getObjectKeysAlphabetical(obj) {
var keys = [],
key;
for (key in obj) {
if (obj.hasOwnProperty(key))
keys.push(key);
}
keys.sort();
return keys;
}
var obj = {}; //Your object here.
var keys = getObjectKeysAlphabetical(obj)
i = 0, key = null, val = null;
//Iterate the array of sorted keys.
for (i = 0; i < keys.length; i++) {
key = keys[i];
val = obj[key]; //Get the value of the property here.
}