using Array.isArray instead of Object.prototype.toString to check if array