Immutable Updates with "with"Are you looking to update the value in an array but not change the original? Say hello to with(). The with function allows you to update a value in an array but return a copy with the updated value, not update the original. Pretty simple to use: cons...Nov 6, 2024·1 min read
Testing Array Elements in JavaScriptUsing Array.prototype.every() to validate arrays in JavaScriptAug 28, 2023·1 min read
Reversing Arrays in JavaScriptJavaScript has two built-in functions for reversing arrays. The first method is Array.prototype.reverse() which reverses the array in place, meaning we change the original array. const numbers = [5, 10, 15, 20, 25, 30] const reversed = numbers.rever...Aug 20, 2023·1 min read
Crafting Error Trails In JavaScriptUsing Error.prototype.cause to create better errorsAug 19, 2023·2 min read
JavaScript Find LastWe all have used find before on an array, but what if we wanted to start from the end of the array? Well, thanks to findLast you no longer need to perform some weird logic or use an external library to pull this off. In this example, you can see how ...Aug 19, 2023·1 min read
Nullish Coalescing OperatorWe often use the or operator || in JavaScript to create a fallback value. However, this comes with risks, and you should try to use nullish coalescing operator instead ??. When we use the or operator, it will default to the value provided if the valu...Aug 17, 2023·2 min read