You array initialization is incorrect.
See the following test to demonstrate the problems and the comments about them.
Note: This does not address the sort problem because your initial premiss is wrong.
Code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title> Untitled </title>
</head>
<body>
<script type="text/javascript">
var tarr = { q:2, q:1, q:3 };
for (var key in tarr) { alert(key+' : '+tarr[key]); } // results in only the last entry displayed
var tarr = { qa:2, qb:1, qc:3 };
for (var key in tarr) { alert(key+' : '+tarr[key]); } // resultes in 3 entries displayed
</script>
</body>
</html>