-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy path07.arguments.js
31 lines (26 loc) · 1.07 KB
/
07.arguments.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//-------------------------------------------------------------------------------------------------------
// 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 + ""); }
var scenario = [
["Assign to Arguments", "arguments=1"],
["Post ++ Arguments", "arguments++"],
["Post -- Arguments", "arguments--"],
["Pre ++ Arguments", "++arguments"],
["Pre -- Arguments", "--arguments"]
];
var count = 0;
(function test1() {
write("Changing Arguments...");
for (var i=0;i<scenario.length;++i) {
var str = "function f" + i + "() { " + scenario[i][1] + "; }";
try {
eval(str);
} catch (e) {
write("Exception: " + str + " :: " + scenario[i][0]);
continue;
}
write("Return: " + str + " :: " + scenario[i][0]);
}
})();