The error reads “Cannot read property ‘firstName’ of undefined”. Any ideas?
function lookUpProfile(name, prop){
// Only change code below this line
for (var i = 0; i < contacts.length; i++) {
if(contacts[i].firstName === name && contacts[i]['firstName'].hasOwnProperty('prop')) {
return contacts[i][prop]
}
} if (contacts[i]['firstName'] !== name) {
return "No such contact"
} else {
return "No such prop"
}
}
// Only change code above this line
lookUpProfile("Akira", "likes");