Parameters.js 862 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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 dump(a)
  6. {
  7. if (a == null)
  8. {
  9. WScript.Echo("'null'");
  10. }
  11. else if (a == undefined)
  12. {
  13. WScript.Echo("'undefined'");
  14. }
  15. else
  16. {
  17. WScript.Echo(a);
  18. }
  19. }
  20. function f1(a, b)
  21. {
  22. // TODO: Dump arguments.length, argument entries, etc.
  23. dump("f1(a, b)");
  24. dump(a);
  25. dump(b);
  26. }
  27. // Correct number of parameters
  28. f1(1, 2);
  29. // Extra parameters
  30. f1(1, 2, 3, 4);
  31. // Not enough parameters
  32. f1(1);