seal2.js 693 B

12345678910111213141516171819
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. const x = "const x";
  6. this.x = 20;
  7. delete(this.x);
  8. Object.preventExtensions(this);
  9. Object.getOwnPropertyNames(this).concat(Object.getOwnPropertySymbols(this)).forEach(function (p) {
  10. Object.defineProperty(this, p, { configurable: false });
  11. });
  12. if (Object.isSealed(this)) {
  13. WScript.Echo("PASS");
  14. }