Javascript String splitOnSpaces();
splitOnSpaces()
String.prototype.splitOnSpaces = String.prototype.split.curry(" "); function annoyingAlert(stringToSplit) { $(stringToSplit.splitOnSpaces()).each(function(index, Element) { alert(Element);/*from w ww .ja v a 2 s . c om*/ }); }