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: