The reducer itself takes four parameters: The accumulator: it accumulates the returned values in your reducer. Run So you may ask: What is special about array object then?
Only the reference to the original value will be copied!
That way, I avoid side effects. But why? To sort it, we need an ordering function that knows how to compare its elements. It takes one parameter: a function that is called on every element of the array. It reduces the code that you write. To use our own sorting order, we need to supply a function as the argument of arr. We can use them here for neater sorting: arr. Just like map, filter or find, some takes a callback function as its only parameter.
Luckily for us, includes does that for us. If the absolute value of start is greater than the length of the array, it will begin from index 0.
There are a lot of array methods that are great to know like slice, some, flatMap, etc.
It has the same result so new Array 'John' or simply Array 'John' are doing the same thing. That way, I avoid side effects. Awful way to do it right?
based on 29 review