Hey everyone, I'm facing some challenges while trying to create a function. In the code snippet provided, I aim to develop the interestMatch function. The goal of this function is to analyze all users and identify those who share the same interest - specifically Bob and Jack in my code. I believe an if statement might be useful here. Perhaps something along the lines of: "if any users have the same interest," then "return this user and consider it a match!" Can anyone lend a hand? Thanks a bunch!
class User {
constructor(username, password, firstname, lastname, email, birthday, gender, interest){
this.username = username;
this.password = password;
this.firstname = firstname;
this.lastname = lastname;
this.email = email;
this.birthday = birthday;
this.gender = gender;
this.interest = interest
}
}
let InterestArray = ["Netflix", "Sports", "Party", "Business", "Children", "Hygge"]
let bob = new User ("bob123", "12345", "Bob", "bobiski", "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="294b464b694b464b074a4644">[email protected]</a>", "2000-10-10", "male", interest[0]);
let jack = new User ("jack20", "340302", "Jack", "jackiski", "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6e040f0d052e040f0d05400d0103">[email protected]</a>", "2000-06-10", "male", interest[0]);
let thif = new User ("thif20", "204903", "Thifanny", "Thifiski", "<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a5d1cdccc3e5cfc4c6ce8bc6cac8">[email protected]</a>", "2000-09-12", "female", interest[1]);
function interestMatch(){
???
}
console.log(interestMatch())
// Expected console output: "Bob matches with Jack!" as they share the same interest