0
To sort a character array in alphabetical order
input: this is a book output: a book is this
3 Respostas
+ 1
Use array.sort() method:
e.g.
var arr = ["this", "is", "a", " book"];
console.log(arr.sort());
outputs: arr = ["a", "book", " is", "this"]
if you want to also arrange in descending character:
console.log(arr.sort());
console.log(arr.reverse());
0
I had tried this.It didn't work.
0
Which language are you coding with, because the above is JavaScript and works flawlessly.