Sunday, 29 March 2009 11:38
I've been going through my $HOME looking for things to post, and came across this little snippet:
function inArray( needle, haystack ) { var i=0; var n=haystack.length for( i; i<n; i++ ) { if( isArray( haystack[i] ) ) if( inArray( needle, haystack[i] ) ) { return true; break; } if( haystack[i] == needle ) { return true; break; } } return false; } function isArray( testObject ) { return testObject && !(testObject.propertyIsEnumerable('length')) && typeof testObject === 'object' && typeof testObject.length === 'number'; }
Notice that "inArray" calls "isArray", so they are both required if using "inArray".
Last Updated on Thursday, 23 April 2009 14:19
Add your comment
Featured Extensions
|
$10.00
$5.00 You Save: $5.00 |
$3.00
|
$3.00
|
$1.00
|


