Skip to content

Instantly share code, notes, and snippets.

@jjvillavicencio
Created January 31, 2019 15:52
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 jjvillavicencio/5aadf4bec8944632f35a0e7d23b4273d to your computer and use it in GitHub Desktop.
Save jjvillavicencio/5aadf4bec8944632f35a0e7d23b4273d to your computer and use it in GitHub Desktop.
var fecha = new Date();
var horaActual = fecha.getHours();
var saludo;
if (horaActual > 18) {
saludo = 'Buenas noches, '
} else if (horaActual > 12) {
saludo = 'Buenas tardes, '
} else if (horaActual > 0) {
saludo = 'Buen día, '
} else {
saludo = 'Bienvenido, '
}
console.log(saludo);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment