Hi,
I’m trying to solve the profile lookup problem without using the hasOwnProperty() method. I came up with this code but I don’t understand why it’s not working properly. Can anyone enlighten me as to why?
var i = 0;
while (i < contacts.length) {
if (((firstName == contacts[i].firstName) == true) && (contacts[i][prop] == false)) {
return "No such property";
}
else if (firstName == contacts[i].firstName) {
return contacts[i][prop];
}
i++;
}
return "No such contact";
Thanks!