Finding ways to improve and optimize your code takes a lot of time, research and energy. Level up your coding skills one step at a time with this collection of quick tips and tricks.
Easily remove duplicates from a JavaScript array using the built-in Set
object.
JavaScript, Array · Jun 12, 2021
Did you know you can get the index of an array item in a JavaScript for...of loop? Learn how with this bite-sized tip.
JavaScript, Array · Jul 25, 2021
Did you know you can define an iterator for any JavaScript value? This quick tip will show you how.
JavaScript, Array · Jun 12, 2021
When working with numeric arrays in JavaScript, you might need to find the minimum or maximum value. Here's a quick and easy way to do it.
JavaScript, Array · Nov 6, 2021
ESLint is a really useful tool, but sometimes it gets in the way. Learn how to refactor code to get rid of a common warning.
JavaScript, Array · Jun 12, 2021
Have you ever wanted to serialize an object but only include certain keys? Turns out JavaScript provides an easy way to do this!
JavaScript, Object · Jul 6, 2021
Ever wanted to get the value of an HTML input element as a number? Learn an easy way to do it with this handy trick.
JavaScript, Browser · Jun 12, 2021
Pretty-printing JSON objects in pretty easy and customizable in JavaScript. Here's the gist of it.
JavaScript, Object · Jul 30, 2022
Array destructuring can be leveraged in many different ways. Here's one of them.
JavaScript, Array · Aug 28, 2022
Learn how to filter branches based on whether they contain a specific commit or not.
Git, Branch · May 25, 2023
Avoid the naive approach and use a more robust method to edit URL parameters in JavaScript.
JavaScript, String · Dec 7, 2022
Using Document.elementFromPoint()
to easily get the element at a specific point on the page.
JavaScript, Browser · Dec 18, 2022
In React components, you might need to conditionally apply a className
. Learn how to handle empty values correctly using this handy tip.
React, Components · Nov 7, 2021
Learn how to quickly write code to sort JavaScript arrays with this handy one-liner.
JavaScript, Array · Jun 12, 2021
Turns out the Proxy object is not extensible, but there's a way around its limitations.
JavaScript, Object · Apr 17, 2023