Edit in JSFiddle

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

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

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