I've been grappling with this task for more than sixty minutes and am at a loss on what to incorporate... Instructions:
-Filtering Data.. The search functionality of the application empowers users to filter contacts in various manners. The interviewer has requested that you exclude those who do not possess an Instagram account.
Utilize the given contacts array to store the contacts without an Instagram account in a variable named 'noInstagram.' Avoid simply hard-coding the solution into the variable, instead programmatically filter out the contacts from the array.
let contacts = [
{
name: "Jane Doe",
age: 21,
social_media: {
instagram: "jane.doe",
twitter: "jane_doe"
}
},
{
name: "John Doe",
age: 21,
social_media: {
instagram: "john.doe",
twitter: "john_doe"
}
},
{
name: "Mary Deer",
age: 21,
social_media: {
twitter: "mary_deer"
}
},
{
name: "Gary Deer",
age: 21,
social_media: {
twitter: "gary_deer"
}
}
]
How Im starting off.
let noInstagram = contacts.filter((contact) => {
if ( !contact.social_media.instagram){
console.log(contact)
}
})