The $w() function splits a string into an Array, treating all whitespace as delimiters.
$w(String);
<html> <head> <title>Prototype examples</title> <script type="text/javascript" src="/javascript/prototype.js"> </script> <script> function ShowValues() { var str = "Apples Bananas Kiwis"; // Convert string into Array var arr = $w(str); arr.each(function(value){ alert(value); }); } </script> </head> <body> <p>Click "Show Value" button to see the result</p> <form> <input type="button" value="Show Value" onclick="ShowValues();"/> </form> </body> </html>
To understand it in better way you can Try it yourself.
Advertisement