Was struggling with Profile Lookup and ended up getting the “right” answer. How could i improve?
Here is the answer i used to finish the excercise.
// Only change code below this line
const akiraProfile = [...contacts][0];
// console.log(akiraProfile);
const harryProfile = [...contacts][1];
// console.log(harryProfile);
const sherlockProfile = [...contacts][2];
const kristianProfile = [...contacts][3];
if ( prop = 'lastName' && name === kristianProfile.firstName) {
return kristianProfile.lastName;
}
if (prop = 'likes' && name === sherlockProfile.firstName) {
return sherlockProfile.likes
}
if (prop = 'likes' && name === harryProfile.firstName) {
return harryProfile.likes
}
if (name === 'Bob') {
return 'No such contact';
}
if (prop !== 'likes' || prop !== 'lastName' || prop !== 'number') {
return 'No such property'
}