Why this code is taken as correct when there's no link between the function and the object?


in the code bellow, is happening the following:
1. the key "property" is not linked to "firstName" in the object named "friends".
2. the object "whatever" is not linked to the object "friends"

However, the outcome is correct. Only the first names of both entries are printed. Why is that?

var friends = {
bill: {
firstName: 'Bill',
lastName: 'Gates',
number: '0055 9900099',
address: [1, 'Parramatta Rd', 'NSW', 2000],

steve: {
    firstname: 'Steve',
    lastName: 'Jobs',
    number: '00998877',
    address: [5, 'Camp Street', 'VIC', 3000],

var list = function (whatever) {
for (var property in whatever) {

Shouldn't it be this?:
var list = function (friends) {
for (var firstName in friends) {

Which by the way works also


@megarockstar97056 you could do it either way, since property and whatever are variables that are local to the function. whatever takes on the value of the parameter passed in, and property takes on the value of the current property as it loops through whatever.