Tell us what’s happening:
le test 09 ne se valide pas alors que quand je le fais sa sort la chaine demandé
Your code so far
let contacts = [
{
firstName: "Akira",
lastName: "Laine",
number: "0543236543",
likes: ["Pizza", "Coding", "Brownie Points"],
},
{
firstName: "Harry",
lastName: "Potter",
number: "0994372684",
likes: ["Hogwarts", "Magic", "Hagrid"],
},
{
firstName: "Sherlock",
lastName: "Holmes",
number: "0487345643",
likes: ["Intriguing Cases", "Violin"],
},
{
firstName: "Kristian",
lastName: "Vos",
number: "unknown",
likes: ["JavaScript", "Gaming", "Foxes"],
},
];
function lookUpProfile(name,property){
for(let prop in contacts){
if(name===contacts[prop].firstName&&contacts[prop][property]!==undefined){
console.log(contacts[prop].firstName)
return contacts[prop][property]
}else if(contacts[prop][property]===undefined&&name===contacts[prop].firstName){
return "no such property"
}
}
return "No such contact"
}
console.log(lookUpProfile('Akira','address'))
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36 Edg/143.0.0.0
Challenge Information:
Build a Profile Lookup - Build a Profile Lookup