Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created April 23, 2019 17:43
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 parzibyte/9f7d4e170b7e1394b7bca5252cf3761b to your computer and use it in GitHub Desktop.
Save parzibyte/9f7d4e170b7e1394b7bca5252cf3761b to your computer and use it in GitHub Desktop.
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