DEV Community

Vincent Baquiro
Vincent Baquiro

Posted on

Recursion in array

Hi Guys I'm a newbie here,

can you help me with these problem to create recursion adding the elements in the invoicelist.

let InvoiceList = ["Invoice 008", "Invoice 007", "Invoice 006", "Invoice 005"];

function insertToBottom(status) {
if (status.length > 0) {
return 1;
} else {
insertToBottom(status.length - 1);
}
}

console.log(
insertToBottom(["Invoice 008", "Invoice 007", "Invoice 006", "Invoice 005"])
);

Top comments (0)