How to reverse a "string" and an "array" using while loop in JavaScript?
See this example.
<script> const s_word = '58 45dr-P'; const rev = [...s_word] .sort() // sort the word (punctuations first, followed by numbers, uppercase followed by lowercase alphabets .reverse() // reverse the sort order .join(''); // join the string (remove the commas) document.writeln(rev); // Output: rdP8554- </script>
How to "split" a string into Multiple lines in a web page using JavaScript?
Happy coding. 🙂