summaryrefslogtreecommitdiffstats
path: root/js/src/tests/non262/object/hasOwn.js
blob: cb9ebda5db76b0a621138f09e107631fa388049e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/*
 * Any copyright is dedicated to the Public Domain.
 * https://creativecommons.org/publicdomain/zero/1.0/
 */

assertEq(Object.hasOwn({}, "any"), false);
assertThrowsInstanceOf(() => Object.hasOwn(null, "any"), TypeError);

var x = { test: 'test value'}
var y = {}
var z = Object.create(x);

assertEq(Object.hasOwn(x, "test"), true);
assertEq(Object.hasOwn(y, "test"), false);
assertEq(Object.hasOwn(z, "test"), false);

if (typeof reportCompare === "function")
    reportCompare(true, true);