alphabetize / coding

Alphabetize

Motasem [Motasem2345]
a month ago

0

hello i need some help in alphabetize / coding challenge i have tried in some way to solve it but it did not work
this is the code i used
ar words = document.getElementsByName(“words”)[0].innerHTML;
words.value=words.split(“\n”).sort().join(“\n”);
document.getElementsByName(“answer”)[0].innerHTML = words.value;
and
var words = document.getElementById(“words”); // or whatever…
answer.value = words.value.split(“\n”).sort().join(“,”);
also
function myFunction(){
var text = document.getElementById(‘words’).value;
var textArray = words.split(“\n”).sort();
var output= document.getElementById(‘answer’);
output.value = textArray.toString().replace(/,/g,“ ”);
}

0replies
1voice
98views
You must be logged in to reply to this discussion. Login
1 of 1

This site only uses cookies that are essential for the functionality of this website. Cookies are not used for tracking or marketing purposes.

By using our site, you acknowledge that you have read and understand our Privacy Policy, and Terms of Service.

Dismiss