[Javascript] JS Array test
JS Student
tuofamerikazmostwanted at gmail.com
Wed Jun 25 02:33:46 CDT 2008
Hi,
I use the following piece of code to test if an element (el) is an
array. Can anybody please suggest some improvemnts or point out any
errors? So far it's been working fine for me but I just wanted to get
some expert opinion on.
/**CODE BEGIN**/
if ((typeof(el)=="object")
&& (typeof(el.length)=="number")
&& ((el.length==0) || (!(el[0]===undefined)))) {
//Perform array operations
}
/**CODE END**/
Regards,
Aaron
More information about the Javascript
mailing list