Edit in JSFiddle

var add = function(previousValue, currentValue, index, array){ //show all arguments passed
    return previousValue + currentValue;
};

var array1 = [2,4,6,3,6];

// add up all of the values in the array (from right to left)
// think of it like so (((2+4)+6)+3)+6
console.log(array1.reduce(add)); //log 21