Articles with the tag #tricks:
What are numeric separators?
2021-03-11
When working with large numbers it can be hard to read them out, try to read this value for example: …read more
JavaScript array methods and how to use them
2021-03-06
Arrays are as central to JavaScript as in many other languages, in this article we will go through the most useful array methods along with creative usage examples. …read more
How to format numbers
2021-02-28
The native Intl.NumberFormat API lets you format numbers for specific languages without any external dependencies. …read more
Format "5 days ago" localized relative date strings in a few lines with native JavaScript
2021-02-27
The native Intl.RelativeTimeFormat API can generate nicely formatted relative date/time strings without any external dependencies. …read more
Use more ergonomic custom events
2020-09-21
While we have CustomEvent for all of our events that need 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
2020-09-21
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?
2020-09-20
Gone are the days where you had to add incremental nullish (undefined or null) checks when fetching values in nested objects. Let's do more with less code. …read more
How-to create and use mixins in JavaScript
2020-09-15
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
2020-09-15
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 at 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
2020-09-13
This is a tiny and handy function to round a number to a specific precision: …read more