//sample solution
function countDown(current) {
// Recursive case
if (current > 1) {
console.log(current);
countDown(current - 1);
}
// Base case
if (current === 1){
console.log(current);
}
}
// We start the loop by calling the function.
countDown(5);
No comments:
Post a Comment