I can’t seem to figure this one out can someone please help it has been over 3 hours now and I read all the comments from previous people that asked but still nothing seems to work
Your code so far
<!-- file: index.html -->
/* file: styles.css */
/* file: script.js */
// User Editable Region
playingSong.textContent ? currentTitle : "";
songArtist.textContent ? currentArtist: "";
};
// User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:127.0) Gecko/20100101 Firefox/127.0
Challenge Information:
Learn Basic String and Array Methods by Building a Music Player - Step 70
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.
how are you setting a value to playSond.textContent?
Check if ‘playingSong.textContent’ matches the ‘currentTitle’ (equality).
If it does, set playingSong.textContent to currentTitle . Otherwise, set it to an empty string.
Use the same approach for the second part of the challenge.
I feel so dumb what must I assign?
Here is my update version.
playingSong.textContent === currentTitle ? playingSong.textContent = currentTitle : playingSong.textContent = “”;
the condition should be on the left side of the question mark (as you did in the last post), and if the condition is evaluated to a truthy value playingSong.textContent will be set to currentTitle(as it is already given here in the code as the first value after the question mark), else it will be an empty string “” (the value after the colon).
Apply the same approach for the second part of the challenge.
I still don’t understand why can’t we use the === or == operators to check for the truthy value instead we assign the value on the left to the currentTitle but I kind of get it now but yeah I guess I need to cry before figuring it out.