use Array.isArray() instead of instanceof Array