textContent sets the text of a node and allows you to set or retrieve the text content of an HTML element.
<div id="example">This is some text content</div>
const element = document.getElementById('example');
console.log(element.textContent); // Output: This is some text content
Use a ternary operator to check if currentTitle is truthy. If so, implicitly return currentTitle otherwise implicitly return an empty string. Assign this result to playingSong.textContent.
Then, use a ternary operator to check if currentArtist is truthy. If so, implicitly return currentArtist otherwise implicitly return an empty string. Assign this result to songArtist.textContent.
I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.
Thanks a bunch. I figured it out. The property comes first, then the ternary operator for variable.
Thanks Again for Quick Responses. Really appreciate it.
Thank You for your quick responses. I figured it out. My statement was incorrect. I needed to put the value of property first and then ternary operator.
Thanks a bunch.
This is the best explanation ever. My brain is so tiny that even I could not read properly this simply requests such as
’ Assign this result to songArtist.textContent .
and i started messing with it. instead asign to it
songArtist.textContent = then code here
Thank you so much for your explanation
Thanks a million