Articles with the tag #tricks:

Use more ergonomic custom events

While we have CustomEvent for all of our events that needs to carry data the need for the detail property nesting can feel a bit cumbersome. …read more

10 great JavaScript tricks that will improve your productivity

These top tips and tricks will help you dramatically increase your productivity while coding in any JavaScript project. …read more

Why should I start using Optional Chaining and Nullish Coalescing operators?

Gone are the days there you had to add incremental nullish (undefined or null) checks when fetching values in nested objects. Lets do more with less code. …read more

How-to create and use mixins in JavaScript

Mixins are handy when you want to share a feature across multiple classes without using inheritance as only some of the child classes should have that feature. …read more

How to use keyword arguments in JavaScript

Passing an Object named options to a function instead of separate arguments is one of the oldest tricks in the book, by also assigning an empty object by default you also reduce the amount of if statements needed in the top of the function. But a year ago I learned how combining this with object deconstruction made it so much more elegant. …read more

Rounding a number to a specific precision in JavaScript

The Math.round function will always round to a whole number and sometimes you want to round a number to a specific precision. …read more