Skip to content

Instantly share code, notes, and snippets.

@agustinpfs
Last active July 7, 2020 19:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agustinpfs/987496ef992a74522fdeb9a8a2163f29 to your computer and use it in GitHub Desktop.
Save agustinpfs/987496ef992a74522fdeb9a8a2163f29 to your computer and use it in GitHub Desktop.
Javascript básico. Bucle for.
//Ejemplo 1:
let i;
for (i = 0; i < 5; i++) {
// Se ejecuta 5 veces, con valores desde paso desde 0 hasta 4.
console.log('Dando ', i, ' vuelta');
};
//Ejemplo 2:
let javascript = ["variables", "funciones", "condicionales", "loops"];
let texto = "";
let i;
for (i = 0; i < javascript.length; i++) {
texto += "Aprendí " + javascript[i] + " en javascript. \n";
}
console.log(texto);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment