This function calls a given closure/function with every element in a given string and returns true as soon as the callback condition is met.
stringSome(inputString,callback)
returns boolean
inputString.some(callback)
Name | Type | Required | Default | Description |
---|---|---|---|---|
inputString | string | Yes | Original input string to search. | |
callback | function | No | The closure function that is executed for each element in the string. |
Are any of the characters in the string greater than our condition?
instring="abcdefg";
callback=function(inp){return inp > "f"}
writeoutput(StringSome(instring,callback));
Are any of the characters in the string greater than our condition?
instring="abcdefg";
callback=function(inp){return inp > "f"}
writeoutput(instring.some(callback));