-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy path01.octal.js
44 lines (40 loc) · 1.13 KB
/
01.octal.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
32
33
34
35
36
37
38
39
40
41
42
43
44
//-------------------------------------------------------------------------------------------------------
// 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 + ""); }
// Octal number
(function Test1() {
var str = "Octal number";
try {
eval("01");
} catch (e) {
write("Exception: " + str);
return;
}
write("Return: " + str);
})();
// Octal string literal
(function Test2() {
var str = "Octal string literal";
try {
eval("\'\\02\'");
} catch (e) {
write("Exception: " + str);
return;
}
write("Return: " + str);
})();
// Hex followed by octal
(function Test3() {
var str = "Octal number following a hex number";
var a;
try {
eval("a = 0x1; a = 01;");
}
catch (e) {
write("Exception: " + str);
return;
}
write("Return: " + str);
})();