Last active
July 1, 2019 23:56
-
-
Save pajaro5/247ecc7015b6be41babdd1bef5ea7c30 to your computer and use it in GitHub Desktop.
Función recursiva que recibe dos parámetros: contador y máximo. Imprime en forma ascendente
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Arriba</title> | |
</head> | |
<body> | |
</body> | |
<script> | |
var arriba = function(contador,maximo){ | |
if (maximo === contador) { | |
console.log(contador); | |
} else { | |
console.log(contador); | |
return arriba(contador+1,maximo); | |
} | |
} | |
arriba(1,10) //imprime los números del 1 al 10 | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment