instanceof Array is not reliable. you should use Array.isArray(), or Object.prototype.toString.call(arr) === '[object Array]'