I'm trying to return the value of N and all decending numbers to 0 added together

can someone help me understand why this function isn’t returning the reduce value of newArry? it just logs function: reduce. I’m trying to find the final value of N descending to zero and then adding all those numbers together. One of the challenges on codeaccademy.

I wanted to create a new array using a loop to get the numbers from N to zero, then use reduce to add them together. But it just isn’t working and I don’t know why.

function simpleAdd(number) {
let i = number;
let newArry = ;
do {i - 1; newArry.push(i–)}
while (i >= 0);
console.log(newArry.reduce)
}
simpleAdd(2)

Hi, Katie.
Your code just logs reduce function because you don’t call it. If you want to log the reduce value, you should call the function by adding parentheses at the end of newArry.reduce and pass arguments. Without arguments reduce won’t work.
Also, your function won’t return anything, because you forgot return keyword.

And your syntax for do…while loop doesn’t look right to me. It should be:

do {
  newArray.push(i);
  i--;
}
while (i >= 0); 

In fact, if you use condition i >= 0 , you can use just a while loop:

while(i >= 0){
  newArray.push(i);
  i--;
}