Skip to content

Latest commit

 

History

History
19 lines (15 loc) · 293 Bytes

Reversed sequence.md

File metadata and controls

19 lines (15 loc) · 293 Bytes

Description:

Build a function that returns an array of integers from n to 1 where n>0.

Examples (input --> output):

n=5 --> [5,4,3,2,1]

Solution:

const reverseSeq = n => {
let arr = [];
  for (let i=n; i>0; i--) {
    arr.push(i);
    } return arr;
};