Tell us what’s happening:
hi
Thank you for the lessons that you have provided.
I just want to let you know that the tester in this lesson is case sensitive. I think a note/important message could be provided.
Informing the user to make sure the text he entered in the code is similar to the text that is provided.
Unless the lessons requires us to find that the text we inserted doesnt match the one that was requested.
it did not take me much time to figure it out. but maybe for some it will. thats why i am recommending this.
many thanks
**Your code so far**
// Setup
var 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, prop) {
// Only change code below this line
for(var i = 0; i < contacts.length; i++) {
//checking first name
if(contacts[i]["firstName"] == name) {
//checking validity of property
if(contacts[i].hasOwnProperty(prop) == false) {
return "No such property"
} else {
//above two are false return value of property
return contacts[i][prop];
}
}
}
return "No such contact";
// Only change code above this line
}
console.log(lookUpProfile("Bob", "number"));
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36
Challenge: Profile Lookup
Link to the challenge: