Skip to content

Instantly share code, notes, and snippets.

@a0viedo
Created October 31, 2014 15:56
Show Gist options
  • Save a0viedo/941757b264056ca1d055 to your computer and use it in GitHub Desktop.
Save a0viedo/941757b264056ca1d055 to your computer and use it in GitHub Desktop.
//cuentaRecursiva recibe un número y cuenta cuantas veces lo tiene que decrementar por uno para llegar a cero (caso base)
function cuentaRecursiva(numero){
if(numero === 0) {
return 0;
}
return 1 + cuentaRecursiva(numero - 1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment