Created
June 12, 2020 01:22
-
-
Save agustinpfs/1ee01ddb5a83a310741ffe63aa0d2443 to your computer and use it in GitHub Desktop.
Javascript básico. Condicionales.
This file contains 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
/////////////1º | |
// if (3>4) { | |
// console.log("3 es menor que 4"); | |
// } | |
// var edad = 17; | |
// if (edad >= 18) { | |
// console.log("Puede pasar"); | |
// } else { | |
// console.log("Prohibido pasar menores"); | |
// } | |
// en funciones: | |
function miFuncion(edad) { | |
console.log("Bienvenido"); | |
if (edad >= 18) { | |
console.log("Puede pasar"); | |
} | |
} | |
miFuncion(18) | |
/////////////2º | |
// Declaración "else" Indica el código que se ejecutará si la condición es falsa. | |
function miFuncion(edad) { | |
console.log("Bienvenido"); | |
if (edad >= 18) { | |
console.log("Puede pasar"); | |
} else { | |
console.log("Prohibido para menores"); | |
} | |
} | |
miFuncion(15) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment