You REALLY Shouldn’t Use the Array.reduce Method!

What do you mean? “Functions for nothing”

Array.forEach is no better!

const total = (arr) => {
let result = 0;
arr.forEach(num => { result += num });
return result;
};
const total = (arr) => arr.reduce((result, num) => result + num, 0)
function arrTotal(arr) {
for (
var i = 0, result = 0, iLen = arr.length;
i < iLen;
i++
) result += arr[i];
return result;
}
function arrTotal(arr) {
var result = 0;
for (var value of arr) result += value;
return result;
}

Testing it!

reduce vs. old is a wash, for/of kicks names and takes a**
Edge (Well, Chakra) overhead for functions is off the cuff. Even the old “for” loop method is blazing fast by comparison.
Firefox is better than Edge on the function overhead, but still not blowing my skirt up.

How is that even possible?!?

var testLI = document.querySelectorAll('#test > li');

for (var i = 0, iLen = testLI.length; i < iLen; i++) {
testLI[i].textContent = 'test #' + i;
}
var li = document.getElementById('test').firstElementChild;if (li) do {
li.textContent = 'something';
} while (li = li.nextElementSibling);

Conclusions:

Accessibility and Efficiency Consultant, Web Developer, Musician, and just general pain in the arse