Exercise 6-Mine is working but need explanation


#1

So I wrote this and it works fine but I am confused on how this is working, So i pass a value onto the parameter "pm". then it runs the for-in loop. so does the value on "pm" assign to the variable firstName in the for in loop?

Thank you.

var list = function(pm)
{
for(firstName in friends)
{
console.log(firstName);
}

};


#2

no, firstName gets assigned the value from the friends object. You can access objects which are declared outside a function from inside a function


#3

Thank you, so then what's the point of the function's parameter?


#4

None? The function doesn't require a parameter


#5

Oh i thought it did! I guess it just to run it then!
Thank you!!


#6