Are you wondering how to reverse the words in a string without using the split, reverse, and join functions?
Here is the problem: You need to reverse the words in a string. For example, if the input is "Hello World," the output should be "World Hello."
<script>
var newString = "";
var theString = prompt("Enter a Phrase that you would like to reverse (Ex. Hello world)");
// Your code here
document.write(newString);
</script>
Although you could easily achieve this using built-in methods, the challenge is to only use the following:
- Arrays
- Substring
- charAt()
How would you approach this task?