| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- //-------------------------------------------------------------------------------------------------------
- // Copyright (C) Microsoft. All rights reserved.
- // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
- //-------------------------------------------------------------------------------------------------------
- function write(v) { WScript.Echo(v + ""); }
- function Test1()
- {
- write("Declaration Test1")
- };
- Test1();
- var Result1 = function Test1()
- {
- write("Expression Test1")
- };
- Test1();
- Result1();
- var Result2, Test2;
- Result2 = function Test2(n)
- {
- if (n < 0)
- {
- write("Test2: Less 0");
- }
- else
- {
- write("Test2: Greater 0");
- Test2(-n);
- }
- }
- Test2 = function Test2(n)
- {
- write("In second Test2");
- };
- Result2(2);
- var fact, factorial;
- fact = function factorial(n)
- {
- return n<=1?1:n*factorial(n-1)
- };
- factorial = function factorial(n)
- {
- return -1
- };
- write("Test3 factorial : " + fact (3));
- function Test4()
- {
- write("first declaration of Test4")
- };
- Test4();
- function Test4()
- {
- write("Second declaration of Test4")
- };
- Test4();
- function Test5(n)
- {
- return n<=1?1:n*Test5(n-1)
- };
- var Result5 = Test5;
- Test5 = function (n)
- {
- return -1
- };
- write("Test5 factorial : " + Result5(3));
- var Test6 = function Test6()
- {
- write(Test6)
- };
- var Result6 = Test6;
- Test6 = "Outer Binding";
- Result6();
|