Just wanted to know if I can use Linq on Javascript arrays. If not is their a 3rd party tool I can use?
+1
A:
no, however frameworks (eg jquery) has some functions that can be used.
It's funny this morning I wanted a String.ForEachEndsWith(arr[]) method. So I created something like this:
String.prototype.endsWith = function(str)
{ return (this.match(str + "$") == str) }
String.prototype.forEachEndsWith = function(str_array)
{
var result = false;
for(var index = 0;index < str_array.length;index++)
{
var current = str_array[index].toUpperCase();
if (this.toUpperCase().endsWith(current))
{
result = true;
return result;
}
}
result = false;
return result;
}
Russell
2009-12-02 02:53:13