'Contact List' bug(ish)


So I am almost completed with the Contact List code and after researching and figuring out what the correct code is, I've realized that they never go over the 'prop' part in any of the lessons that I've seen. I could, of course, be wrong, but I haven't noticed it. The part I mean is:

var search = function(name){
for (var prop in friends){
if (friends[prop].firstName === name) {
return friends[prop];

All the 'prop' parts weren't explained. Now, through deductive reasoning, I assume that they are there to list all the properties under the name that you entered? Again, I could be wrong and I am more unsure about that than that they didn't explain what they were for.

If someone knows where it was explained and can point me in that direction, it would be most appreciated. Otherwise, y u no explan, Codecademy?


I now see that the 'prop' is interchangeable to anything that you want to set it to, just like any 'for' loop. This just wasn't made clear. I had never seen the for/in statement in use. It looked weird. Mystery solved.


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