Better Developer Experience with function arguments as an object
Write more readable code and help your colleagues and yourself
Passing an object as an argument is easier to read when you use the function in other places. The function also gets the added benefit of more flexibility when editing as the order of the arguments doesn't matter anymore. In this small guide I'll show you why and how.
Improving accessibility with a skip-link
Allow jumping straight to the main content skipping the long navigation
Accessibility is hard. You have to find the right balance between helping and not obstructing the browser defaults. When surfing a well structured page with a screenreader or the tab key you mostly start at the navigation. But what if the navigation is really long with a lot of links. That's a lot of tabbing. We can solve this with a simple 'skip-link'.
Watching for viewport changes with the Intersection Observer API
Trigger events when they scroll into your viewport
Want to create animations on scroll? Or you need to update your Table of Contents when the reader is scrolling your article? You want to use the browser's Intersection Observer API.