Take this array of numbers, and return a new array with each number multiplied by the next number. Basically, calculate the total of each number in the array, multiplied together. For example, if the array were, 4,5,6,7 the total would be 4 * 5 *6*7 = 840.
You can use this array:
var testArray1 = [4,8,12,16,20,24,28,32,40,44,48,52,56,60,64,68,72,76,80,84,88,92,96,100,104,108,112,116,120,124,128,132,136,140,144,148,152,3,156,160,164,168,172,176,180,184,188,192,196,200,204];
The easiest way is to use reduce.
Answer: 6.554255395433374e+95
ReplyDelete