Before reading this blog entry, please have a quick look at my earlier blog entry null typeof shock.
In the earlier blog (null typeof shock), using typeof operator returns misleading value object.
To make it clear,
var myArr = Array(); // creating variable myArr and assigning a array into it //var myArr = ; // another way of doing it alert(typeof(myArr)); // object, NOT array
So how do you make sure if a variable is given, it is an array?
Here comes instanceof operator to rescue.
alert(myArr instanceof Array) // true.