recursion countdown javascript
function countdown(n){
if (n < 1) {
return [];
} else {
const arr = countdown(n - 1);
arr.unshift(n);
return arr;
}
}
console.log(countdown(5)); // [5, 4, 3, 2, 1]
Also in JavaScript:
- Failed to load module script: The server responded with a non-JavaScript MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.
- cant find variable react
- javascript style background color
- get top items from json object
- javascript palindrome
- npm windows shocut
- export aab react native
- create many items from an array to canvas
- cancel settimeout
- moment use in angular
- how pass data from body in koa js
- chartjs y axis prefix
- chrome extension get current tab from popup
- mysql json change key
- create a node js project in with worker
- This version of CLI is only compatible with Angular versions ^9.0.0-beta || >=9.0.0 <10.0.0, but Angular version 8.1.3 was found instead.
- angular submit form programmatically
- javascript check if date object
- js rename property
- js scrollto
- convert int to float in javascript
- Discord.js Get A Bot To Join A Music Chanel
- react toastify does not have design
- javascript array add end