Iterates over a string and runs the closure function for each element in the string.
stringEach(string,callback)
returns void
string.each(callback)
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| string | string | Yes | The input string. | |
| callback | any | Yes | The closure function that is executed for each element in the string. The syntax is callback(element,index,string). |
letters="ahqwz";
callback=function(inp){ writeoutput(inp == "q");}
StringEach(letters,callback);
letters="ahqwz";
letters.each(function(inp){writeoutput(inp == "q");});