Nick Melms
sudonomad.bsky.social
Nick Melms
@sudonomad.bsky.social
In JavaScript arrays are objects, and objects are passed by reference! This means that a reference to the memory location is passed instead of the actual value. Changes made to one variable can affect another if they point to the same object.

#JavaScript #webdev #fundamentals
December 30, 2024 at 3:45 PM
Never realized the callback in higher-order functions like .map, .reduce, and .filter that contain additional parameters such as the index and the original array.

For example, if you wanted to only add up even indices, you could do something like this:

#JavaScript
December 15, 2024 at 5:44 PM