JSFiddle - React, Tailwind, and code Playground

by Alexander

JavaScript

console.clear();

var a = [1,2,3];

console.log(
	reduce(a, (a,i) => a + i, 0 )
);

function reduce(list, cb, memo) {
	return list.length < 1
  		? memo
 			: reduce(list.slice(1,list.length), cb, cb(memo, list[0]))
}