Created
July 7, 2020 19:09
-
-
Save agustinpfs/415ce01d3d48bab6c2536e41e555fdf2 to your computer and use it in GitHub Desktop.
Javascript básico. Condicionales. Declaración else.
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
//Sintaxis | |
if (condicion) { | |
// código que se ejecuta si la condición es verdadera | |
} else { | |
// código que se ejecuta si la condición es falsa | |
} | |
//Ejemplo: | |
function miFuncion(edad) { | |
console.log("Bienvenido"); | |
if (edad >= 18) { | |
console.log("Puede pasar"); | |
} else { | |
console.log("Prohibido para menores"); | |
} | |
} | |
miFuncion(15) // Bienvenido Prohibido para menores | |
miFuncion(19) // Bienvenido Puede pasar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment