This example reverses the words in a string:
var myWord = new String("Welcome to Digital Workshop");
// Split the sting using space as the separator
var myArray = myWord.split(" ");
// Empty the source string
myWord = "";
// Loop through the array
for (myCount = myArray.length; myCount > 0; myCount--)
{
// Don't forget that elements start at 0!
myWord += myArray[ myCount - 1 ] + " ";
}
Debug.trace( myWord );