I tried a ternary for this question because it seems thats the way to check if at this point, but the !== was suggested to be used for this, and it still doesn’t seem to work…
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
case "forward":
setPlayerCards(players.filter((player => player.position !== "forward")));
// User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Challenge Information:
Learn Modern JavaScript Methods by Building Football Team Cards - Step 41
reminder on how filter works: filter works that it keeps the values for which the callback function returns true and removes the values for which the callback function returns false, so depending on what you need you could use a comparison with !==, but not always
you are using a ternary, and as player.position is a truthy value, the ternary would always give back "forward", which is truthy, which means filter is keeping all of the items in the array.
I don’t think that the ternary is needed here
you need an expression that returns true when player.position is "forward" and false otherwise
I can’t write it for you.
What was the issue with the expression you where using?
that it returns false when player.position is false, right? and you want the opposite. Can you make a small change to this so that it works as you need?
your function now returns undefined, because you are not using implitic return anymore
also, forward should be a string, you don’t have a variable of that name
and you have extra parentheses