-
-
Save parzibyte/9f7d4e170b7e1394b7bca5252cf3761b to your computer and use it in GitHub Desktop.
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
const actualizarSemaforo = colorActual => ({ | |
verde: "amarillo", | |
amarillo: "rojo", | |
rojo: "verde", | |
}[colorActual]) | |
// Probar | |
const colores = [ | |
"amarillo", "rojo", "verde" | |
]; | |
colores.forEach(color => { | |
console.log(`Para ${color} la siguiente luz debe ser: ${actualizarSemaforo(color)}`) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment