You can just use instanceof Array or Array.isArray() here.