How to multiply the 1st number with the next : Sum All Numbers in a Range

Tell us what’s happening:

How do I get each element that goes through the array and multiply it with the next?
My 1st thaught that it should be i * i because it holds the numbers of the array
so the outcome would be
1 *1 * 2
but that doesn’t seem to work any hint’s about it would be great :3 or things i have to revieuw to understand it better.

Your code so far

function sumAll(arr) {
 Math.min(arr); //finds the lowest number and takes it 1
 Math.max(arr);  //finds the largest number 4
//must start at the 1st number and loops over until the max value is reached
//0 start at the 0th index of the array 
//++ increament by one so 1 2 3 4 
//multiply's each number
//.lenght until the lenght of the array is reached
var i;
for (i = 0; i < arr.length; i++){
i * i;
 return 1;

sumAll([1, 4]);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36.

Challenge: Sum All Numbers in a Range

Link to the challenge:

i think first you already determine the starting point by math.min and the ending point by the math.max , now you need only to place them into your loop and add new variable as accumulator ,

1 Like

The first thing to correct is that return 1, because no matter the input to your function, it will always output the same thing (1).

1 Like

It was there from the beginning if you reset the code it will be there. So i thought I could not change it