var check = [1,2,3,4,5]; var check1 = check.reduce((accumulator,element,index,array) => element ) console.log(check1); //output :5. Why?
This is intended! It's because your reducer here is returning every item (your
element parameter) in the array and once we reach the end, we are returning the last item (which happens to be 5).