I found a very useful function reduce(), and I\'m using it, but I\'m not sure if I understand it properly. Can anyone help me to understand this function?
Taken from here, arr.reduce() will reduce the array to a value, specified by the callback. In your case, it will basically sum the elements of the array.
Steps:
.reduce() as the second argument. Return sum od 0 and 1, which is 1.