foreach_nativearray_change.js 716 B

123456789101112131415161718
  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. var IntArr1 = new Array();
  6. prop1 = 1;
  7. IntArr1[0] = 1;
  8. IntArr1[1] = 1;
  9. IntArr1[3] = 2147483647;
  10. IntArr1[2] = 1;
  11. IntArr1 = IntArr1.concat(prop1);
  12. // Native Int Array change to Native Float Array in the middle of forEach
  13. IntArr1.forEach(function (element, index) {
  14. WScript.Echo(IntArr1[index]++);
  15. WScript.Echo(element);
  16. });