Ajuda com javascript #2232
Unanswered
chastombergithub
asked this question in
Perguntas e Respostas
Replies: 3 comments 5 replies
-
Já tentou colocar um sort() no lugar do Math.random()? |
Beta Was this translation helpful? Give feedback.
2 replies
-
@chastombergithub tenta aqui: https://www.w3schools.com/jsref/jsref_sort.asp |
Beta Was this translation helpful? Give feedback.
3 replies
-
function randomico() { var possible = "Preciso alterar por esta frase em ordem crescente"; //var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Preciso retirar o random deste código e deixá-lo em ordem crescente para não embaralhar a frase. Segue abaixo o código.
`
Exibir Original
Limparvar textoOriginal = '';
var entrada = document.getElementById("entrada");
function embaralhar(event) {
var x = event.which || event.keyCode;
if (x !== 8) {
}
};
function exibir() {
document.getElementById("texto").innerHTML = textoOriginal;
};
function limpar() {
textoOriginal = '';
document.getElementById("texto").innerHTML = '';
document.getElementById("entrada").value = '';
};
function randomico() {
var possible = "Preciso alterar por esta frase em ordem crescente";
//var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
return possible.charAt(Math.floor(Math.random() * possible.length));
}
String.prototype.replaceAt = function(index, character) {
return this.substr(0, index) + character + this.substr(index + character.length);
}
Beta Was this translation helpful? Give feedback.
All reactions