I have a list of gameData and used athletes. I need to make a new array that only contains Athlete from gameData that is not in usedAthletes. I've honestly looked all over, tried lodash and various things over the past day or so. Any advise would be great. If there are ES6 methods that work it would be cool to know that too :)
const gameData = [
{Athlete: "Peyton Manning", Img: "url"},
{Athlete: "Tony Hawk", Img: "url"},
{Athlete: "Tom Brady", Img: "url"},
{Athlete: "Usain Bolt", Img: "url"},
{Athlete: "Kevin Durant", Img: "url"},
{Athlete: "Cristiano Ronaldo", Img: "url"},
{Athlete: "Michael Phelps", Img: "url"},
{Athlete: "Conor McGregor", Img: "url"},
{Athlete: "Phil Mickelson", Img: "url"},
{Athlete: "Stephen Curry", Img: "url"},
{Athlete: "Rory McIlroy", Img: "url"},
{Athlete: "Mike Trout", Img: "url"},
{Athlete: "Danica Patrick", Img: "url"},
{Athlete: "Drew Brees", Img: "url"},
{Athlete: "Carmelo Anthony", Img: "url"},
{Athlete: "Ryan Lochte", Img: "url"},
{Athlete: "Eli Manning", Img: "url"},
{Athlete: "Chris Paul", Img: "url"}
]
const usedAthletes = ["Peyton Manning", "Tony Hawk", "Tom Brady"];
gameData.forEach( x => {
const gameDataNamesOnly = x.Athlete;
newAnswerlist = [];
usedAthletes.forEach( item => {
if(gameDataNamesOnly != item){
//I was trying to push to newAnswerList here but could get access to gameDataNamesOnly correctly or something.
}
})
console.log(newAnswerlist)
})