
|
<SCRIPT> var str = prompt("Please enter 3 words:", "I see you"); if (str == "" || str == null) str = "I see you"; //
"reverse" the order by "swapping" the words OR str = str.replace(/(\w+)\s(\w+)\s(\w+)/, "$3 $2 $1"); alert(str); document.write(str); </SCRIPT> |