рекурсия mdn

const recurse = (x) => {
   if x > 0:
       print(x)
       recurse(x - 1)
}
recurse(10)
Busy Bee