Array-of-surfaces.js (520B)
1 // Check superficial features of Array.of. 2 3 load(libdir + "asserts.js"); 4 5 var desc = Object.getOwnPropertyDescriptor(Array, "of"); 6 assertEq(desc.configurable, true); 7 assertEq(desc.enumerable, false); 8 assertEq(desc.writable, true); 9 assertEq(Array.of.length, 0); 10 assertThrowsInstanceOf(() => new Array.of(), TypeError); // not a constructor 11 12 // When the this-value passed in is not a constructor, the result is an array. 13 for (let v of [undefined, null, false, "cow"]) 14 assertEq(Array.isArray(Array.of.call(v)), true);