Hi Emma! Thank you for sharing this, it's very useful!
Here's a quick tip I'd like to share.
Instead of writing document.querySelector()/document.querySelectorAll() multiple times, you could do this:
document.querySelector()
document.querySelectorAll()
const $ = document.querySelector.bind(document); const $$ = document.querySelectorAll.bind(document); const list = $(".dropdown__list"); const listContainer = $(".dropdown__list-container"); const dropdownArrow = $(".dropdown__arrow"); const listItems = $$(".dropdown__list-item");
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi Emma! Thank you for sharing this, it's very useful!
Here's a quick tip I'd like to share.
Instead of writing
document.querySelector()
/document.querySelectorAll()
multiple times, you could do this: