pop3.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 test(a)
  6. {
  7. a = a.pop();
  8. return a;
  9. }
  10. var arr = [ { a : 3 }];
  11. var r = test(arr);
  12. WScript.Echo(r.a);
  13. arr = [ { a: 3 }];
  14. r = test(arr);
  15. WScript.Echo(r.a);
  16. // Test that popping a gap accesses the prototype chain
  17. function f(a) {
  18. while (a.length > 0)
  19. a.pop();
  20. }
  21. f(['x',,'x']);
  22. Object.defineProperty(Object.prototype,"1",{get: function(){ WScript.Echo("getter"); }, configurable:true});
  23. f(['x',,'x']);
  24. function f_float(a) {
  25. while (a.length > 0)
  26. a.pop();
  27. }
  28. delete Object.prototype[1];
  29. var x = [1.2];
  30. x[3] = 1.4;
  31. f_float(x);
  32. Object.defineProperty(Object.prototype,"1",{get: function(){ WScript.Echo("getter"); }, configurable:true});
  33. x = [1.1];
  34. x[2] = 1.3;
  35. f_float(x);