es5array_arrayproto.js 880 B

12345678910111213141516171819202122232425262728293031
  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. function write(args)
  6. {
  7. WScript.Echo(args);
  8. }
  9. write("test 1");
  10. function test()
  11. {
  12. obj[0] = 1;
  13. write(obj[0]);
  14. }
  15. var obj = [];
  16. Object.defineProperty(Array.prototype, "0", { value:"blah", writable: false });
  17. test();
  18. test();
  19. write("test 2");
  20. function test2(){
  21. var VarArr0 = [];
  22. VarArr0[4] = 1;
  23. Object.defineProperty(Array.prototype, "4", {configurable : true, get: function(){ return 30;}});
  24. WScript.Echo(VarArr0.slice(0, 10));
  25. };
  26. // generate profile
  27. test2();