lookUpProfile
function that takes name
and a property (prop
) as arguments has been pre-written for you.
The function should check if name
is an actual contact's firstName
and the given property (prop
) is a property of that contact.
If both are true, then return the "value" of that property.
If name
does not correspond to any contacts then return "No such contact"
If prop
does not correspond to any valid properties of a contact found to match name
then return "No such property"
"Kristian", "lastName"
should return "Vos"
'
testString: 'assert(lookUpProfile("Kristian","lastName") === "Vos", ""Kristian", "lastName"
should return "Vos"
");'
- text: '"Sherlock", "likes"
should return ["Intriguing Cases", "Violin"]
'
testString: 'assert.deepEqual(lookUpProfile("Sherlock", "likes"), ["Intriguing Cases", "Violin"], ""Sherlock", "likes"
should return ["Intriguing Cases", "Violin"]
");'
- text: '"Harry","likes"
should return an array'
testString: 'assert(typeof lookUpProfile("Harry", "likes") === "object", ""Harry","likes"
should return an array");'
- text: '"Bob", "number"
should return "No such contact"'
testString: 'assert(lookUpProfile("Bob", "number") === "No such contact", ""Bob", "number"
should return "No such contact"");'
- text: '"Bob", "potato"
should return "No such contact"'
testString: 'assert(lookUpProfile("Bob", "potato") === "No such contact", ""Bob", "potato"
should return "No such contact"");'
- text: '"Akira", "address"
should return "No such property"'
testString: 'assert(lookUpProfile("Akira", "address") === "No such property", ""Akira", "address"
should return "No such property"");'
```