Why doesn't dot notation work with this loop? I wrote the following, but I got an error:


Replace this line with your code.

Continuing the discussion from 27 Looks for-in to me:


i find this strange, but objects are also associative arrays in js, i find this weird, someone does a good job at trying to explain it (link)


Because property is a string.

And in dot notation we can't do something like this:


it must be:

nameOfObject.nameOfProperty // this is not a string




you got to be kidding me right? Question of mellauyellow:

The dot notation only with the object name, in your for loop property is a string, which it is why the dot notation is not working, @factoradic just explained this, and it perfectly answers your question!!