-
-
Save DavidPeralvarez/ca1a888763d7de895f9321e761014ed8 to your computer and use it in GitHub Desktop.
JavaScript - Operador condicional ternario
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Curso de Javascript</title> | |
</head> | |
<body> | |
<script src="scripts.js"></script> | |
</body> | |
</html> |
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
var tengoSalmon = true, | |
tengoAlgaNori = true, | |
tengoArroz = true; | |
function maquisSalmon( salmon, alga, arroz ){ | |
// if ( salmon && alga && arroz ) { | |
// return 'Puedo hacer maquis.'; | |
// } else { | |
// return 'No puedo hacer maquis.'; | |
// } | |
return ( salmon && alga && arroz ) ? 'Puedo hacer maquis.' : 'No puedo hacer maquis.'; | |
} | |
console.log( maquisSalmon( tengoSalmon, tengoAlgaNori, tengoArroz ) ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment