Don't know how to check if null and implicitly return

Tell us what’s happening:

I’m supposed to check if player.nickname isn’t null and implicitly return it if it isn’t null

Your code so far

playersDropdownList.addEventListener("change", (e) => {
  playerCards.innerHTML = "";


  switch (e.target.value) {
    case "nickname":
      setPlayerCards(players.filter((player) => {player.nickname != null})

Your browser information:

User Agent ist: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36

Challenge Information:

Learn Modern JavaScript Methods by Building Football Team Cards step 42https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures-v8/learn-modern-javascript-methods-by-building-football-team-cards/step-42

be carefull in putting == sign wometime you have to use == Or === based on condition double check it

const a = () => { return null }
Function above return null explicitly

const b = () => null
Function above return null implicitly

You can read more about implict return at Arrow function expressions - JavaScript | MDN
At #function_body section.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.