array_forin.js 692 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 DumpObject(o)
  6. {
  7. for (var i in o)
  8. {
  9. WScript.Echo(i + " = " + o[i]);
  10. }
  11. }
  12. var a = new Array(0xFFFFFFFF);
  13. WScript.Echo(a.length);
  14. a[0xFFFFFFFE] = 1;
  15. DumpObject(a);
  16. function Foo()
  17. {
  18. }
  19. Foo.prototype[3] = 101;
  20. var o = new Foo();
  21. o[3] = 3;
  22. o[4] = 4;
  23. DumpObject(o);