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.
Using Document.elementFromPoint()
to easily get the element at a specific point on the page.
JavaScript, Browser · Dec 18, 2022
Learn how to execute a function for each element of an array, starting from the last one.
JavaScript, Array · Oct 10, 2023
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
Here's a quick tip on how to compare and sort arrays of strings, ignoring case and accents.
JavaScript, String · Jul 17, 2022
Dynamically adding object properties can be pretty slow in some cases. Here's how to optimize it.
JavaScript, Object · Nov 2, 2022
There are many ways to create empty links, some more appropriate than others. Learn how to best handle empty links with this quick tip.
JavaScript, Browser · Jun 12, 2021
The currentColor
CSS keyword is a nifty alternative to custom properties for simple use cases.
CSS, Visual · Nov 30, 2022
Create a debounced function that waits a certain amount of time before invoking the provided function again.
JavaScript, Function · Oct 12, 2023
Make sure to use the correct method when checking if a JavaScript object is an array.
JavaScript, Type · Nov 6, 2022
Mutable default arguments can trip up Python beginners and veterans alike. Here's a quick workaround to deal with them.
Python, Function · Feb 27, 2022
Avoid unnecessary re-runs by using primitive dependencies in your React effect.
React, Hooks · Jun 12, 2022
Scroll listeners can easily become a performance bottleneck for your web application. Here's how to fix that.
JavaScript, Browser · Mar 7, 2023
Learn how to sort a Python dictionary list using a tuple key.
Python, List · Jan 4, 2023