NativeArray_MaxInterpret_OffArrayMissingValueCheckHoist.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 test0(a) {
  6. a[1];
  7. a.reverse();
  8. return a[0];
  9. }
  10. WScript.Echo("test0: " + test0([2, 3]));
  11. WScript.Echo("test0: " + test0([2, 3]));
  12. function test1(a) {
  13. a[1];
  14. a.shift();
  15. return a[0];
  16. }
  17. WScript.Echo("test1: " + test1([2, 3]));
  18. WScript.Echo("test1: " + test1([2, 3]));
  19. function test2(a) {
  20. a[1];
  21. var b = a.slice(0, 0);
  22. return a[0];
  23. }
  24. WScript.Echo("test2: " + test2([2, 3]));
  25. WScript.Echo("test2: " + test2([2, 3]));
  26. function test3(a) {
  27. a[1];
  28. a.splice(0, 0);
  29. return a[0];
  30. }
  31. WScript.Echo("test3: " + test3([2, 3]));
  32. WScript.Echo("test3: " + test3([2, 3]));
  33. function test4(a) {
  34. a[1];
  35. a.unshift();
  36. return a[0];
  37. }
  38. WScript.Echo("test4: " + test4([2, 3]));
  39. WScript.Echo("test4: " + test4([2, 3]));