hasOwnProperty does not work
<p>I got a JSON object (<code>{error:true}</code>) from the server. </p>

<p>I try to check if the object contains the key "error" and either the key exists, the function <code>hasOwnProperty</code> returns <code>false</code>.</p>

<p>This is my code:</p>

<pre><code>$http({
        headers: { 'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8;' },
        url: '/Modules/Partners/Mailing/SendMail.ashx',
        data: $.param({ contact: JSON.stringify(contact), body: partnerObject.mailTemplate.longValue, title: "" }),
        method: 'POST'
    })
    .success(function (data, status, headers, config) {
        console.log(data);
        console.log(data.hasOwnProperty('error'));

       if (data.hasOwnProperty('error')) {
           deferred.reject(contact);
       } else {
           deferred.resolve(contact);
       }
       //console.log(data)

    })
    .error(function (data, status, headers, config) {
        deferred.reject(contact);
    });
</code></pre>

<p>In the console I can see that the object contains the "error" key by the <code>hasOwnProperty('error')</code> returns <code>false</code></p>

<p><a href="https://i.stack.imgur.com/rJwJ7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rJwJ7.png" alt="enter image description here"></a> </p>