Replace Classes
Replace Classes
When one state class should become another, classList.replace describes the change directly. It avoids leaving contradictory classes such as pending and success on the same element.
The visible label should move with the class state so the DOM tells one consistent story.
Your task: Change the deploy status from pending to success. Replace status-pending with status-success, then update the text to Deployed.
Free with a JS Exercises account
Sign in to start coding, run your solution, and keep your progress saved for later. No payment needed.
By continuing, you agree to our Terms and Privacy Policy. We'll send occasional product updates and news. You can unsubscribe anytime.
Replace Classes
When one state class should become another, classList.replace describes the change directly. It avoids leaving contradictory classes such as pending and success on the same element.
The visible label should move with the class state so the DOM tells one consistent story.
Your task: Change the deploy status from pending to success. Replace status-pending with status-success, then update the text to Deployed.