throw_func.js 624 B

12345678910111213141516171819202122232425262728
  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(param)
  6. {
  7. throw function() { return param; }
  8. }
  9. function runtest(param)
  10. {
  11. try
  12. {
  13. test(param)
  14. }
  15. catch (e)
  16. {
  17. WScript.Echo (e());
  18. }
  19. }
  20. runtest("test1");
  21. runtest("test2");