[Vuejs]-How can I compare an array to another array that has a nested array to find matching results?

1👍

    const expected_id = SearchedSkills[0].id
    let filtered_users = []

    for (const user of Users) {
        if (user.id === expected_id)
            filtered_users.push(user)
    }
    console.log(filtered_users)

1👍

You can use Array#some.

return this.user.filter(user => this.skills.some(
        skill => user.skills.some(({id}) => id === skill.id)));

Leave a comment