What does this in statement mean?


var list = function(obj) {
for(var hey in obj) { <-------

what does in mean on line 3?


hey will get assigned each property of obj, then you can print the properties of obj

hey is defined in the loop, so you can name this anything you like.

just like you can access object values by property you can do:


to get all values of obj

for in loop does so much work for you


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