Hello , i need your help ,
i don’t understand why this don’t work
function lookUpProfile(name, prop){
// Only change code below this line
for (var i=0 ; i<contacts.length ;i++){
if (contacts[i]['firstName']===name){
if(contacts[i].hasOwnProperty(prop)){
return contacts[i][prop];
}
return "No such property";
}
}
// Only change code above this line
}
than this work :
function lookUpProfile(name, prop){
// Only change code below this line
for (var i=0 ; i<contacts.length ;i++){
if (contacts[i]['firstName']===name){
if(contacts[i].hasOwnProperty(prop)){
return contacts[i][prop];
}
}
return "No such contact";
}
// Only change code above this line
}
can you explain me ? thanks a lot