Changed array check in _.each to catch arrays and array-like objects

Using hasOwnProperty to verify that length indeed corresponds to an
index of the object