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
absMath.abs(-5.7)5.7PASS / 通过
acosMath.acos(0.5)1.0471975511965976PASS / 通过
asinMath.asin(0.5)0.5235987755982989PASS / 通过
atanMath.atan(1)0.7853981633974483PASS / 通过
atan2Math.atan2(1,1)0.7853981633974483PASS / 通过
ceilMath.ceil(4.2)5PASS / 通过
cosMath.cos(0)1PASS / 通过
expMath.exp(1)2.718281828459045PASS / 通过
floorMath.floor(4.8)4PASS / 通过
logMath.log(1)0PASS / 通过
maxMath.max(3,7)7PASS / 通过
minMath.min(3,7)3PASS / 通过
powMath.pow(2,10)1024PASS / 通过
randomMath.random()random [0,1)PASS / 通过
roundMath.round(4.5)5PASS / 通过
sinMath.sin(0)0PASS / 通过
sqrtMath.sqrt(16)4PASS / 通过
tanMath.tan(0)0PASS / 通过

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 / 通过
charAtts.charAt(0)HPASS / 通过
charCodeAtts.charCodeAt(0)72PASS / 通过
concat"Hello".concat(" World")Hello WorldPASS / 通过
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 / 通过
fromCharCodeString.fromCharCode(65,66)ABPASS / 通过
indexOfts.indexOf("World")6PASS / 通过
italics"hi".italics()<I>hi</I>PASS / 通过
lastIndexOf"abcabc".lastIndexOf("bc")4PASS / 通过
link"HW".link("http://x")<A HREF="http://x">HW</A>PASS / 通过
localeCompare"a".localeCompare("b")-1PASS / 通过
matchts.match(/World/)WorldPASS / 通过
replacets.replace("World","JS")Hello JSPASS / 通过
searchts.search(/World/)6PASS / 通过
slicets.slice(0,5)HelloPASS / 通过
small"hi".small()<SMALL>hi</SMALL>PASS / 通过
split"a,b,c".split(",")a,b,cPASS / 通过
strike"hi".strike()<STRIKE>hi</STRIKE>PASS / 通过
sub"hi".sub()<SUB>hi</SUB>PASS / 通过
substrts.substr(6,5)WorldPASS / 通过
substringts.substring(0,5)HelloPASS / 通过
sup"hi".sup()<SUP>hi</SUP>PASS / 通过
toLocaleLowerCase"HELLO".toLocaleLowerCase()helloPASS / 通过
toLocaleUpperCase"hello".toLocaleUpperCase()HELLOPASS / 通过
toLowerCase"HELLO".toLowerCase()helloPASS / 通过
toUpperCase"hello".toUpperCase()HELLOPASS / 通过

3. Date Object / Date 对象 (43)

Method / 方法Call / 调用Result / 结果Status
getDated.getDate()15PASS / 通过
getDayd.getDay()6PASS / 通过
getFullYeard.getFullYear()2024PASS / 通过
getHoursd.getHours()13PASS / 通过
getMillisecondsd.getMilliseconds()123PASS / 通过
getMinutesd.getMinutes()45PASS / 通过
getMonthd.getMonth()5PASS / 通过
getSecondsd.getSeconds()30PASS / 通过
getTimed.getTime()1718469930123PASS / 通过
getTimezoneOffsetd.getTimezoneOffset()180PASS / 通过
getUTCDated.getUTCDate()15PASS / 通过
getUTCDayd.getUTCDay()6PASS / 通过
getUTCFullYeard.getUTCFullYear()2024PASS / 通过
getUTCHoursd.getUTCHours()16PASS / 通过
getUTCMillisecondsd.getUTCMilliseconds()123PASS / 通过
getUTCMinutesd.getUTCMinutes()45PASS / 通过
getUTCMonthd.getUTCMonth()5PASS / 通过
getUTCSecondsd.getUTCSeconds()30PASS / 通过
getYeard.getYear()2024PASS / 通过
getVarDated.getVarDate()undefinedPASS / 通过
setDatesd.setDate(20)20PASS / 通过
setFullYearsd.setFullYear(2025)2025PASS / 通过
setHourssd.setHours(10)10PASS / 通过
setMillisecondssd.setMilliseconds(99)99PASS / 通过
setMinutessd.setMinutes(30)30PASS / 通过
setMonthsd.setMonth(6)6PASS / 通过
setSecondssd.setSeconds(45)45PASS / 通过
setTimesd.setTime(epoch)1753018245099PASS / 通过
setUTCDatesd.setUTCDate(25)25PASS / 通过
setUTCFullYearsd.setUTCFullYear(2026)2026PASS / 通过
setUTCHourssd.setUTCHours(12)12PASS / 通过
setUTCMillisecondssd.setUTCMilliseconds(0)0PASS / 通过
setUTCMinutessd.setUTCMinutes(15)15PASS / 通过
setUTCMonthsd.setUTCMonth(3)3PASS / 通过
setUTCSecondssd.setUTCSeconds(30)30PASS / 通过
setYearsd.setYear(99)99PASS / 通过
toDateStringd.toDateString()Sat Jun 15 2024PASS / 通过
toGMTStringd.toGMTString()Sat, 15 Jun 2024 16:45:30 UTCPASS / 通过
toLocaleDateStringd.toLocaleDateString()15 junho 2024PASS / 通过
toLocaleTimeStringd.toLocaleTimeString()13:45:30PASS / 通过
toTimeStringd.toTimeString()13:45:30 UTC-0300PASS / 通过
toUTCStringd.toUTCString()Sat, 15 Jun 2024 16:45:30 UTCPASS / 通过
parseDate.parse("2024/06/15")NaNPASS / 通过
UTCDate.UTC(2024,5,15)1718409600000PASS / 通过

4. Array Object / Array 对象 (13)

Method / 方法Call / 调用Result / 结果Status
concat[1,2,3].concat([4,5])1,2,3,4,5PASS / 通过
join[1,2,3].join(",")1,2,3PASS / 通过
pop[1,2,3].pop()3PASS / 通过
push[1,2].push(3)1,2,3PASS / 通过
reverse[1,2,3].reverse()3,2,1PASS / 通过
shift[1,2,3].shift()1PASS / 通过
slice[1,2,3,4].slice(1,3)2,3PASS / 通过
sort[3,1,2].sort()1,2,3PASS / 通过
splice[1,2,3,4].splice(1,2,"a","b")2,3PASS / 通过
toLocaleString[1,2,3].toLocaleString()[object Array]PASS / 通过
toString[1,2,3].toString()1,2,3PASS / 通过
unshift[1,2].unshift(0)0,1,2PASS / 通过
valueOf[1,2,3].valueOf()1,2,3PASS / 通过

5. Global Object / Global 对象 (11)

Method / 方法Call / 调用Result / 结果Status
decodeURIdecodeURI("hello%20world")hello worldPASS / 通过
decodeURIComponentdecodeURIComponent("a%3Db")a=bPASS / 通过
encodeURIencodeURI("hello world")hello%20worldPASS / 通过
encodeURIComponentencodeURIComponent("a=b")a%3DbPASS / 通过
escapeescape("hello world")hello%20worldPASS / 通过
evaleval("2+3")5PASS / 通过
isFiniteisFinite(42)truePASS / 通过
isNaNisNaN(NaN)truePASS / 通过
parseFloatparseFloat("3.14abc")3.14PASS / 通过
parseIntparseInt("0xFF",16)255PASS / 通过
unescapeunescape("hello%20world")hello worldPASS / 通过

6. VBArray Object / VBArray 对象 (5)

Method / 方法Call / 调用Result / 结果Status
dimensionsvbArray.dimensions()SKIP — requires SAFEARRAY from COM / 需要 COM 的 SAFEARRAYSKIP / 跳过
getItemvbArray.getItem(0)SKIP — requires SAFEARRAY from COMSKIP / 跳过
lboundvbArray.lbound(1)SKIP — requires SAFEARRAY from COMSKIP / 跳过
toArrayvbArray.toArray()SKIP — requires SAFEARRAY from COMSKIP / 跳过
uboundvbArray.ubound(1)SKIP — requires SAFEARRAY from COMSKIP / 跳过

7. Enumerator Object / Enumerator 对象 (4)

Method / 方法Call / 调用Result / 结果Status
itemfiles.item()undefinedFAIL / 失败
moveFirstfiles.moveFirst()reset to firstPASS / 通过
moveNextfiles.moveNext()moved to nextPASS / 通过
atEndfiles.atEnd()true (end of collection)PASS / 通过

8. Number Object / Number 对象 (3)

Method / 方法Call / 调用Result / 结果Status
toExponential(3.14159).toExponential(2)3.14e+0PASS / 通过
toFixed(3.14159).toFixed(2)3.14PASS / 通过
toPrecision(3.14159).toPrecision(4)3.142PASS / 通过

9. Regular Expression Object / 正则表达式对象 (3)

Method / 方法Call / 调用Result / 结果Status
exec/hello/i.exec("Hello World")HelloPASS / 通过
test/\d+/.test("abc123")truePASS / 通过
compilere.compile("[0-9]+","g")recompiled, test '123' = trueFAIL / 失败

10. Function Object / Function 对象 (2)

Method / 方法Call / 调用Result / 结果Status
applyadd.apply(null,[3,4])7PASS / 通过
calladdToCtx.call({x:10},3,4)17PASS / 通过

11. Object Object / Object 对象 (2)

Method / 方法Call / 调用Result / 结果Status
hasOwnPropertyobj.hasOwnProperty("name")truePASS / 通过
isPrototypeOfMyClass.prototype.isPrototypeOf(obj)truePASS / 通过

12. Standalone Functions / 独立函数 (5)

Function / 函数Call / 调用Result / 结果Status
GetObjectGetObject("","Scripting.FileSystemObject")objectPASS / 通过
ScriptEngineScriptEngine()JScriptPASS / 通过
ScriptEngineMajorVersionScriptEngineMajorVersion()5PASS / 通过
ScriptEngineMinorVersionScriptEngineMinorVersion()8PASS / 通过
ScriptEngineBuildVersionScriptEngineBuildVersion()16384PASS / 通过

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