There are a few ECMAScript compatibility matrices around: kangax's is good for ES5 only, Thomas Lahn's will tell you which features are supported in what versions of various ECMAScript implementations.
A "third way" is to use a hasOwnProperty test, which works in all browsers and is a good idea in any environment that you don't control completely:
for (var p in obj) {
if (obj.hasOwnProperty(p)) {
// p is an own property of obj
// do stuff with obj[p]
}
}
You can also use Object.keys, which only returns own properties too, but support might be less than for defineProperty.
You should also note that for..in does not necessarily return properties in any particular order and can be shown to return them in different orders in different browsers. So only use it with an Array where the order of accessing members isn't important.
PS. You can also use propertyIsEnumerable too, as it only returns true for properties on the object itself:
if (obj.propertyIsEnumerable(p)) {
This was used to accommodate a bug in early Safari, but that version shouldn't be in use any more.
Incidentally, in:
> typeof(MyArray[i])
there is no need for the brackets, typeof is an operator. Also, checking the Type of a property doesn't tell you if it's an own property of the object or not, or even if it exists (though in this case it does because it's come from for..in).