JScript Built-in Methods Test / JScript 内置方法测试
Tests all 141 JScript built-in methods/functions from the Script 5.6 CHM knowledge base.
测试 Script 5.6 CHM 知识库中全部 141 个 JScript 内置方法/函数。
136 methods across 11 objects + 5 standalone functions.
11 个对象上的 136 个方法 + 5 个独立函数。
1. Math Object / Math 对象 (18)
| Method / 方法 | Call / 调用 | Result / 结果 | Status |
| abs | Math.abs(-5.7) | 5.7 | PASS / 通过 |
| acos | Math.acos(0.5) | 1.0471975511965976 | PASS / 通过 |
| asin | Math.asin(0.5) | 0.5235987755982989 | PASS / 通过 |
| atan | Math.atan(1) | 0.7853981633974483 | PASS / 通过 |
| atan2 | Math.atan2(1,1) | 0.7853981633974483 | PASS / 通过 |
| ceil | Math.ceil(4.2) | 5 | PASS / 通过 |
| cos | Math.cos(0) | 1 | PASS / 通过 |
| exp | Math.exp(1) | 2.718281828459045 | PASS / 通过 |
| floor | Math.floor(4.8) | 4 | PASS / 通过 |
| log | Math.log(1) | 0 | PASS / 通过 |
| max | Math.max(3,7) | 7 | PASS / 通过 |
| min | Math.min(3,7) | 3 | PASS / 通过 |
| pow | Math.pow(2,10) | 1024 | PASS / 通过 |
| random | Math.random() | random [0,1) | PASS / 通过 |
| round | Math.round(4.5) | 5 | PASS / 通过 |
| sin | Math.sin(0) | 0 | PASS / 通过 |
| sqrt | Math.sqrt(16) | 4 | PASS / 通过 |
| tan | Math.tan(0) | 0 | PASS / 通过 |
2. String Object / String 对象 (31)
| Method / 方法 | Call / 调用 | Result / 结果 | Status |
| anchor | "HW".anchor("top") | <A NAME="top">HW</A> | PASS / 通过 |
| big | "hi".big() | <BIG>hi</BIG> | PASS / 通过 |
| blink | "hi".blink() | <BLINK>hi</BLINK> | PASS / 通过 |
| bold | "hi".bold() | <B>hi</B> | PASS / 通过 |
| charAt | ts.charAt(0) | H | PASS / 通过 |
| charCodeAt | ts.charCodeAt(0) | 72 | PASS / 通过 |
| concat | "Hello".concat(" World") | Hello World | PASS / 通过 |
| fixed | "hi".fixed() | <TT>hi</TT> | PASS / 通过 |
| fontcolor | "hi".fontcolor("red") | <FONT COLOR="red">hi</FONT> | PASS / 通过 |
| fontsize | "hi".fontsize(5) | <FONT SIZE="5">hi</FONT> | PASS / 通过 |
| fromCharCode | String.fromCharCode(65,66) | AB | PASS / 通过 |
| indexOf | ts.indexOf("World") | 6 | PASS / 通过 |
| italics | "hi".italics() | <I>hi</I> | PASS / 通过 |
| lastIndexOf | "abcabc".lastIndexOf("bc") | 4 | PASS / 通过 |
| link | "HW".link("http://x") | <A HREF="http://x">HW</A> | PASS / 通过 |
| localeCompare | "a".localeCompare("b") | -1 | PASS / 通过 |
| match | ts.match(/World/) | World | PASS / 通过 |
| replace | ts.replace("World","JS") | Hello JS | PASS / 通过 |
| search | ts.search(/World/) | 6 | PASS / 通过 |
| slice | ts.slice(0,5) | Hello | PASS / 通过 |
| small | "hi".small() | <SMALL>hi</SMALL> | PASS / 通过 |
| split | "a,b,c".split(",") | a,b,c | PASS / 通过 |
| strike | "hi".strike() | <STRIKE>hi</STRIKE> | PASS / 通过 |
| sub | "hi".sub() | <SUB>hi</SUB> | PASS / 通过 |
| substr | ts.substr(6,5) | World | PASS / 通过 |
| substring | ts.substring(0,5) | Hello | PASS / 通过 |
| sup | "hi".sup() | <SUP>hi</SUP> | PASS / 通过 |
| toLocaleLowerCase | "HELLO".toLocaleLowerCase() | hello | PASS / 通过 |
| toLocaleUpperCase | "hello".toLocaleUpperCase() | HELLO | PASS / 通过 |
| toLowerCase | "HELLO".toLowerCase() | hello | PASS / 通过 |
| toUpperCase | "hello".toUpperCase() | HELLO | PASS / 通过 |
3. Date Object / Date 对象 (43)
| Method / 方法 | Call / 调用 | Result / 结果 | Status |
| getDate | d.getDate() | 15 | PASS / 通过 |
| getDay | d.getDay() | 6 | PASS / 通过 |
| getFullYear | d.getFullYear() | 2024 | PASS / 通过 |
| getHours | d.getHours() | 13 | PASS / 通过 |
| getMilliseconds | d.getMilliseconds() | 123 | PASS / 通过 |
| getMinutes | d.getMinutes() | 45 | PASS / 通过 |
| getMonth | d.getMonth() | 5 | PASS / 通过 |
| getSeconds | d.getSeconds() | 30 | PASS / 通过 |
| getTime | d.getTime() | 1718469930123 | PASS / 通过 |
| getTimezoneOffset | d.getTimezoneOffset() | 180 | PASS / 通过 |
| getUTCDate | d.getUTCDate() | 15 | PASS / 通过 |
| getUTCDay | d.getUTCDay() | 6 | PASS / 通过 |
| getUTCFullYear | d.getUTCFullYear() | 2024 | PASS / 通过 |
| getUTCHours | d.getUTCHours() | 16 | PASS / 通过 |
| getUTCMilliseconds | d.getUTCMilliseconds() | 123 | PASS / 通过 |
| getUTCMinutes | d.getUTCMinutes() | 45 | PASS / 通过 |
| getUTCMonth | d.getUTCMonth() | 5 | PASS / 通过 |
| getUTCSeconds | d.getUTCSeconds() | 30 | PASS / 通过 |
| getYear | d.getYear() | 2024 | PASS / 通过 |
| getVarDate | d.getVarDate() | undefined | PASS / 通过 |
| setDate | sd.setDate(20) | 20 | PASS / 通过 |
| setFullYear | sd.setFullYear(2025) | 2025 | PASS / 通过 |
| setHours | sd.setHours(10) | 10 | PASS / 通过 |
| setMilliseconds | sd.setMilliseconds(99) | 99 | PASS / 通过 |
| setMinutes | sd.setMinutes(30) | 30 | PASS / 通过 |
| setMonth | sd.setMonth(6) | 6 | PASS / 通过 |
| setSeconds | sd.setSeconds(45) | 45 | PASS / 通过 |
| setTime | sd.setTime(epoch) | 1753018245099 | PASS / 通过 |
| setUTCDate | sd.setUTCDate(25) | 25 | PASS / 通过 |
| setUTCFullYear | sd.setUTCFullYear(2026) | 2026 | PASS / 通过 |
| setUTCHours | sd.setUTCHours(12) | 12 | PASS / 通过 |
| setUTCMilliseconds | sd.setUTCMilliseconds(0) | 0 | PASS / 通过 |
| setUTCMinutes | sd.setUTCMinutes(15) | 15 | PASS / 通过 |
| setUTCMonth | sd.setUTCMonth(3) | 3 | PASS / 通过 |
| setUTCSeconds | sd.setUTCSeconds(30) | 30 | PASS / 通过 |
| setYear | sd.setYear(99) | 99 | PASS / 通过 |
| toDateString | d.toDateString() | Sat Jun 15 2024 | PASS / 通过 |
| toGMTString | d.toGMTString() | Sat, 15 Jun 2024 16:45:30 UTC | PASS / 通过 |
| toLocaleDateString | d.toLocaleDateString() | 15 junho 2024 | PASS / 通过 |
| toLocaleTimeString | d.toLocaleTimeString() | 13:45:30 | PASS / 通过 |
| toTimeString | d.toTimeString() | 13:45:30 UTC-0300 | PASS / 通过 |
| toUTCString | d.toUTCString() | Sat, 15 Jun 2024 16:45:30 UTC | PASS / 通过 |
| parse | Date.parse("2024/06/15") | NaN | PASS / 通过 |
| UTC | Date.UTC(2024,5,15) | 1718409600000 | PASS / 通过 |
4. Array Object / Array 对象 (13)
| Method / 方法 | Call / 调用 | Result / 结果 | Status |
| concat | [1,2,3].concat([4,5]) | 1,2,3,4,5 | PASS / 通过 |
| join | [1,2,3].join(",") | 1,2,3 | PASS / 通过 |
| pop | [1,2,3].pop() | 3 | PASS / 通过 |
| push | [1,2].push(3) | 1,2,3 | PASS / 通过 |
| reverse | [1,2,3].reverse() | 3,2,1 | PASS / 通过 |
| shift | [1,2,3].shift() | 1 | PASS / 通过 |
| slice | [1,2,3,4].slice(1,3) | 2,3 | PASS / 通过 |
| sort | [3,1,2].sort() | 1,2,3 | PASS / 通过 |
| splice | [1,2,3,4].splice(1,2,"a","b") | 2,3 | PASS / 通过 |
| toLocaleString | [1,2,3].toLocaleString() | [object Array] | PASS / 通过 |
| toString | [1,2,3].toString() | 1,2,3 | PASS / 通过 |
| unshift | [1,2].unshift(0) | 0,1,2 | PASS / 通过 |
| valueOf | [1,2,3].valueOf() | 1,2,3 | PASS / 通过 |
5. Global Object / Global 对象 (11)
| Method / 方法 | Call / 调用 | Result / 结果 | Status |
| decodeURI | decodeURI("hello%20world") | hello world | PASS / 通过 |
| decodeURIComponent | decodeURIComponent("a%3Db") | a=b | PASS / 通过 |
| encodeURI | encodeURI("hello world") | hello%20world | PASS / 通过 |
| encodeURIComponent | encodeURIComponent("a=b") | a%3Db | PASS / 通过 |
| escape | escape("hello world") | hello%20world | PASS / 通过 |
| eval | eval("2+3") | 5 | PASS / 通过 |
| isFinite | isFinite(42) | true | PASS / 通过 |
| isNaN | isNaN(NaN) | true | PASS / 通过 |
| parseFloat | parseFloat("3.14abc") | 3.14 | PASS / 通过 |
| parseInt | parseInt("0xFF",16) | 255 | PASS / 通过 |
| unescape | unescape("hello%20world") | hello world | PASS / 通过 |
6. VBArray Object / VBArray 对象 (5)
| Method / 方法 | Call / 调用 | Result / 结果 | Status |
| dimensions | vbArray.dimensions() | SKIP — requires SAFEARRAY from COM / 需要 COM 的 SAFEARRAY | SKIP / 跳过 |
| getItem | vbArray.getItem(0) | SKIP — requires SAFEARRAY from COM | SKIP / 跳过 |
| lbound | vbArray.lbound(1) | SKIP — requires SAFEARRAY from COM | SKIP / 跳过 |
| toArray | vbArray.toArray() | SKIP — requires SAFEARRAY from COM | SKIP / 跳过 |
| ubound | vbArray.ubound(1) | SKIP — requires SAFEARRAY from COM | SKIP / 跳过 |
7. Enumerator Object / Enumerator 对象 (4)
| Method / 方法 | Call / 调用 | Result / 结果 | Status |
| item | files.item() | undefined | FAIL / 失败 |
| moveFirst | files.moveFirst() | reset to first | PASS / 通过 |
| moveNext | files.moveNext() | moved to next | PASS / 通过 |
| atEnd | files.atEnd() | true (end of collection) | PASS / 通过 |
8. Number Object / Number 对象 (3)
| Method / 方法 | Call / 调用 | Result / 结果 | Status |
| toExponential | (3.14159).toExponential(2) | 3.14e+0 | PASS / 通过 |
| toFixed | (3.14159).toFixed(2) | 3.14 | PASS / 通过 |
| toPrecision | (3.14159).toPrecision(4) | 3.142 | PASS / 通过 |
9. Regular Expression Object / 正则表达式对象 (3)
| Method / 方法 | Call / 调用 | Result / 结果 | Status |
| exec | /hello/i.exec("Hello World") | Hello | PASS / 通过 |
| test | /\d+/.test("abc123") | true | PASS / 通过 |
| compile | re.compile("[0-9]+","g") | recompiled, test '123' = true | FAIL / 失败 |
10. Function Object / Function 对象 (2)
| Method / 方法 | Call / 调用 | Result / 结果 | Status |
| apply | add.apply(null,[3,4]) | 7 | PASS / 通过 |
| call | addToCtx.call({x:10},3,4) | 17 | PASS / 通过 |
11. Object Object / Object 对象 (2)
| Method / 方法 | Call / 调用 | Result / 结果 | Status |
| hasOwnProperty | obj.hasOwnProperty("name") | true | PASS / 通过 |
| isPrototypeOf | MyClass.prototype.isPrototypeOf(obj) | true | PASS / 通过 |
12. Standalone Functions / 独立函数 (5)
| Function / 函数 | Call / 调用 | Result / 结果 | Status |
| GetObject | GetObject("","Scripting.FileSystemObject") | object | PASS / 通过 |
| ScriptEngine | ScriptEngine() | JScript | PASS / 通过 |
| ScriptEngineMajorVersion | ScriptEngineMajorVersion() | 5 | PASS / 通过 |
| ScriptEngineMinorVersion | ScriptEngineMinorVersion() | 8 | PASS / 通过 |
| ScriptEngineBuildVersion | ScriptEngineBuildVersion() | 16384 | PASS / 通过 |
Summary / 测试汇总
Total Tests / 总测试数: 141
Passed / 通过: 139
Failed / 失败: 2
Skipped / 跳过: 5 (VBArray — requires COM SAFEARRAY)
2 function(s) failed: item | compile |
Source / 来源: Script 5.6 CHM — js56jslrfjscriptmethodstoc.htm (111 in TOC) + js56jslrfjscriptfunctionstoc.htm (5) + 25 files on disk not in TOC
Total: 18 + 31 + 43 + 13 + 11 + 5 + 4 + 3 + 3 + 2 + 2 + 5 = 141 methods/functions