michael@0: // Check superficial features of Array.of. michael@0: michael@0: load(libdir + "asserts.js"); michael@0: michael@0: var desc = Object.getOwnPropertyDescriptor(Array, "of"); michael@0: assertEq(desc.configurable, true); michael@0: assertEq(desc.enumerable, false); michael@0: assertEq(desc.writable, true); michael@0: assertEq(Array.of.length, 0); michael@0: assertThrowsInstanceOf(() => new Array.of(), TypeError); // not a constructor michael@0: michael@0: // When the this-value passed in is not a constructor, the result is an array. michael@0: for (let v of [undefined, null, false, "cow"]) michael@0: assertEq(Array.isArray(Array.of.call(v)), true);