Learn Basic String and Array Methods by Building a Music Player - Step 70

Tell us what’s happening:

I am writing my expressions using ternary operation but have tried all means, I fail

Your code so far

<!-- file: index.html -->

/* file: styles.css */

/* file: script.js */
// User Editable Region

 const =currentTitle=> ? 'ifTrue' : ifFalse'{
currentTitle="playingSong.textContent";
  }else {
    currentTitle="";
  }
  if(currentArtist ? truthy){
    currentArtist=songArtist.textContent;
  }else {
    curretArtist="";
  }

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0

Challenge Information:

Learn Basic String and Array Methods by Building a Music Player - Step 70

That is my code so far but fail
currentTitle ? ‘ifTrue’ : ‘ifFalse’){
currentTitle=“playingSong.textContent”;
}else{
currentTitle=“”;
}if (currentArtist ? ‘truthy’){
currentArtist=‘songArtist.textContent’;
}else{
curretArtist=“”;
};

Your code so far

<!-- file: index.html -->

/* file: styles.css */

/* file: script.js */
// User Editable Region

  currentTitle ? 'ifTrue' : 'ifFalse'){
    currentTitle="playingSong.textContent";
  }else{
    currentTitle="";
  }if (currentArtist ? 'truthy'){
    currentArtist='songArtist.textContent';
  }else{
      curretArtist="";
  };


// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0

Challenge Information:

Learn Basic String and Array Methods by Building a Music Player - Step 70

const example = condition ? "I'm true" : "I'm false";

When you consider this example, you should do something like that when using ternary:

playingSong.textContent = condition ? "true" : "false"

Condition is currentTitle. It will return true or false. You should change true or false parts of this ternary according the things that given to you in the challenge.

if (currentTitle) {
string urlName =“”;
currentTitle = playingSong.textContent;
} else {
currentTitle = “”;
}

if (currentArtist) {
currentArtist = songArtist.textContent;
} else {
currentArtist = “”;
}

Tell us what’s happening:

Hi help me with this, I cant really figure out why I cant make it here

Your code so far

<!-- file: index.html -->

/* file: script.js */
// User Editable Region

  currentTitle ? 'ifTrue' : 'ifFalse'{
    currentTitle="playingSong.textContent";
  }else{
    currentTitle="";
  }if (currentArtist ? truthy){
    currentArtist='songArtist.textContent';
  }else{
      currentArtist="";
  }


// User Editable Region
/* file: styles.css */

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0

Challenge Information:

Learn Basic String and Array Methods by Building a Music Player - Step 70

Hi @manambamakanga

A ternary operator is a shorthand way of writing an if/else statement.
Have another look at the example given in the instructions.

Happy coding