Can anyone explain why the following angular.js code gives me an error in Internet Explorer 11 (Windows 8.1):
'Object doesn't support property or method 'hasOwnProperty''

if (key != 'prototype' && key != 'length' && key != 'name' && obj.hasOwnProperty(key)) {
    iterator.call(context, obj[key], key);
}

The code belongs inside the forEach function in angular.js

Is there a solution or workaround to this problem?

I replaced obj.hasOwnProperty(key) with Object.prototype.hasOwnProperty(obj, key) and this seemed to work, although I have no idea what the implications will be on other sections of my site that use this code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.