The four individual console.log() calls output exactly what I expect, except for the the first one. Why is it saying length is 0?
Only numerical properties are taken into account for length. 'ko' is not numerical.
From the specification:
The length property of this Array object is a data property whose value is always numerically greater than the name of every deletable property whose name is an array index.
Where array index is defined as:
A property name P (in the form of a String value) is an array index if and only if ToString(ToUint32(P)) is equal to P and ToUint32(P) is not equal to 232−1.
Therefore ko is not an array index.
The one in the $.each() iterator doesn't output anything. Why not?
Because jQuery recognizes the arguments as array an iterates over its values, probably in this way:
for(var i = 0; i < arg.length; i++)
You already noticed that translations.length is 0.
You are making the mistake to use an array as associative array. Use an object instead:
var translations = {};
translations['ko'] = {};
The reason why you can assign non-numerical properties to arrays is simply the fact that arrays are objects too. But that does not mean that you should use them as such. The special array methods don't apply to non-numerical properties.
I'd suggest you read more about arrays in the MDN JavaScript Guide.