Skip to content

Instantly share code, notes, and snippets.

@skvggor
Created October 13, 2014 14:38
Show Gist options
  • Save skvggor/53208bcd88a940961e17 to your computer and use it in GitHub Desktop.
Save skvggor/53208bcd88a940961e17 to your computer and use it in GitHub Desktop.
Verifica se campo esta vazio, com mais de 40 caracteres e se é número.
function exibirNomeUsuario() {
var span, nome;
span = document.querySelector(".nome-usuario");
nome = prompt("Qual é o seu nome?", "");
if ((nome === "") || (nome.length >= 40) || (!isNaN(nome))) {
nome = "comédia";
}
span.innerHTML = nome;
}
exibirNomeUsuario();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment