06.arguments.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. (function Test1(x,y) {
  7. write(x + " " + arguments[0]);
  8. write(y + " " + arguments[1]);
  9. x = 100;
  10. y = 200;
  11. write(x + " " + arguments[0]);
  12. write(y + " " + arguments[1]);
  13. }) (10,20);
  14. (function Test2(x,y) {
  15. write(x + " " + arguments[0]);
  16. write(y + " " + arguments[1]);
  17. arguments[0] = 100;
  18. arguments[1] = 200;
  19. write(x + " " + arguments[0]);
  20. write(y + " " + arguments[1]);
  21. }) (10,20);
  22. (function Test3(x,y) {
  23. write(x + " " + arguments[0]);
  24. write(y + " " + arguments[1]);
  25. eval("arguments[0] = 100;");
  26. eval("y = 200;");
  27. write(x + " " + arguments[0]);
  28. write(y + " " + arguments[1]);
  29. }) (10,20);