es5array_enum_edit.js 763 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. // Test to ensure we honor the attributes of newly added property during enumeration
  6. var a = [ 0, 1, 2 ];
  7. Object.defineProperty(a, "10", { writable: false, value:10, enumerable:true });
  8. var mod = false;
  9. for (var i in a)
  10. {
  11. if (!mod) {
  12. Object.defineProperty(a, "5", { writable: false, value:5, enumerable:false });
  13. mod = true;
  14. }
  15. WScript.Echo(i);
  16. }