So, we split s
- Create the sortedWords array(mutable, so the values can be re-assigned), let sortedWords = new Array(splitText.length), the initial data in this array is the undefined data type.
- loop through the array splitText then do the following:
- get the last character of each word, which is the number
- convert it to number as it is a string, then make it zero based (as we're using it for array purposes)
- get the word without the number,
- we then reassign the values in the sortedWords array using the indexInSortedArray like this, sortedWords[indexInSortedArray] and asssigning it to cleanWord