What´s up people, I´ve been trying to get this exercise and nothing, could anyone light me up?
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
evaluates to a truthy value. If it does, set playingSong.textContent
to currentTitle.
Otherwise, set it to an empty string.
Then below that, use a ternary operator to check if currentArtist
is truthy. If so, set songArtist.textContent
to currentArtist
. Otherwise, set it to empty string.
**THIS IS MY CODE **
const currentTitle = currentTitle ? playingSong.textContent : “”;
const currentArtist = currentArtist ? songArtist.textContent : “”;
};
const currentTitle = currentTitle ? playingSong.textContent : "";
const currentArtist = currentArtist ? songArtist.textContent : "";