Still lots of general setup-y stuff today, but I did learn a few things.
I was listening to this episode of Syntax on the way to work this morning, and learned some tasty new JS array methods.
I made a CodePen for code examples.
.some() tests whether at least one element in the array passes the test you provide as a callback function. Note that it immediately returns as soon as it finds the first true value, so it has no idea if there are multiple elements within the array that would pass true. It only cares that there’s at least one.
.includes() checks whether the array includes a specific value you pass in, returning true or false.
.from() creates a new array from an array-like or iterable object. Note that it only creates a shallow copy, so nested values aren’t copied. You can also pass in an optional map function to call on every element of the array as it is added.