If you use this code in a browser, this is because an object window(which is a global object) has a property lengththat represents the number of child view contexts (iframe, etc.) that it has. This 0, if they are not (which often happens). All the properties of the object windoware global, so lengthitself is lengthon windowso foo[length]- foo[0]that is "hello".
length foo. foo foo.length. , undefined, foo.length 3, foo[3].