Update forEach array check

Currently forEach is checking to see if the object has a property length and that length is a number. I've changed it to use Array.isArray because an object could be assigned a property length that is a number, that does not represent the number of properties in the object itself. Under those circumstance the object (as a hash table) would be handled as an array.