Skip to content

Instantly share code, notes, and snippets.

@Renatodeluna
Created June 21, 2015 04:25
Show Gist options
  • Save Renatodeluna/0790f349383401d97c31 to your computer and use it in GitHub Desktop.
Save Renatodeluna/0790f349383401d97c31 to your computer and use it in GitHub Desktop.
Create array random
var array = [ 'Bom Dia', 'Boa Noite', 'Boa Tarde'],
posicao = Math.floor(array.length * Math.random()),
texto = array[posicao];
console.log(texto);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment