Hi,
A newbie here, while trying to learn the concept of Profile Lookup, after adding these codes,
function lookUpProfile(name, prop){
// Only change code below this line
for (var x = 0; x < contacts.length; x++) {
if (contacts[x].firstName === firstName) {
if (contacts[x].hasOwnProperty(prop)) {
return contacts[x][prop];
} else {
return "No such property";
}
}
}
return "No such contact";
// Only change code above this line
}
// Change these values to test your function
lookUpProfile("Akira", "likes");
An error “firstName is not defined”, so I added “var name = firstName;” still error, only “var firstName = name;” will be accepted, why?
Thanks for the help in advance.