CJCoding With Joseph

Add a Status Class Based on a Score

The div with id="result" has a data-score attribute. Read the score as a number: if it is 60 or higher, add the class "pass"; otherwise add the class "fail".

Platform-Provided HTML (READ-ONLY):
<div id="result" data-score="85">Score</div>

Steps:
1. Read the number with parseInt(el.dataset.score).
2. Use an if/else to decide which class to add.
3. Add the class with classList.add().

Expected Output:

<div id="result" data-score="85" class="pass">Score</div>
Topics:
HTML DOM
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (clog, fn, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.