delete.js 1012 B

1234567891011121314151617181920212223242526
  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(v) { WScript.Echo(v + ""); }
  6. Object.prototype[5] = "obj.proto5";
  7. Object.prototype[7] = "obj.proto7";
  8. Array.prototype[1] = "arr.proto.1";
  9. Array.prototype[2] = "arr.proto.2";
  10. Array.prototype[3] = "arr.proto.3";
  11. Array.prototype[6] = "arr.proto.6";
  12. var n=8;
  13. var i=0;
  14. var arr = new Array(n);
  15. for (i=3;i<n;i++) { arr[i] = i * i + 1; }
  16. write(delete arr[1]); write("T1:" + arr.length + " : " + arr);
  17. write(delete arr[3]); write("T2:" + arr.length + " : " + arr);
  18. write(delete arr[n-1]); write("T3:" + arr.length + " : " + arr);
  19. write(delete arr[n+1]); write("T4:" + arr.length + " : " + arr);