Is there a way of sorting an array by length of letters?
If the array is as follows:
Code:
var phrase = new Array();
phrase[0] = "The cat ate the dog";
phrase[1] = "The cat ate the mouse";
phrase[2] = "The cat came back the very next day";
phrase[3] = "The cat";
phrase[4] = "The dog";
document.write(phrase);
Within document.write I want to sort out the last two because they're short.