window.location
window.location
window represents the browser environment around the document. window.location.hash stores the fragment identifier at the end of the URL.
Interfaces often mirror the selected section in the URL hash so a user can return to the same spot.
Your task: Read the active section's data-slug value. Set window.location.hash to that slug with a leading #, and update the hash status text to Hash set to <slug>.
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.
window.location
window represents the browser environment around the document. window.location.hash stores the fragment identifier at the end of the URL.
Interfaces often mirror the selected section in the URL hash so a user can return to the same spot.
Your task: Read the active section's data-slug value. Set window.location.hash to that slug with a leading #, and update the hash status text to Hash set to <slug>.