Getting IN-timate (question on property placeholder)


#1


The code is correct, I am just wondering why anything can be used as the placeholder for property. Why isn't there a specific word such as "property" that is used to print out all the elements in an object?


Replace this line with your code.


#2

There is no specific keyword since programmers need freedom to name their variables to fit the implementation in a semantic way.

for (var key in object)

is the pattern, but we can name things whatever we wish.

for (var item in items)

for (var friend in friends)

etc.


#3

Makes sense, Thank you.


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.