Can anyone please tell me what is wrong in this solution? I have used else if statements instead of if else statement.
function lookUpProfile(name, prop) {
// Only change code below this line
let i=0;
for(i=0;i<contacts.length;i++){
if((contacts[i].firstName === name)&&(contacts[i].hasOwnProperty(prop)===true)){
return contacts[i][prop]
}
else if((contacts[i].firstName !== name)){
return 'No such contact'
}
else if(contacts[i].hasOwnProperty(prop)===false){
return 'No such property'
}
}
// Only change code above this line
}
lookUpProfile("Akira", "likes");
Challenge: Profile Lookup
Link to the challenge: