JScript ランゲージ リファレンス、toGMTString メソッド
WScript.Echo(new Date().toGMTString());
JScript ランゲージ リファレンス、toArray メソッド
まんま
<HEAD> <SCRIPT LANGUAGE="VBScript"> <!-- Function CreateVBArray() Dim i, j, k Dim a(2, 2) k = 1 For i = 0 To 2 For j = 0 To 2 a(j, i) = k document.writeln(k) k = k + 1 Next document.writeln("<BR>") Next CreateVBArray = a End Function --> </SCRIPT> <SCRIPT LANGUAGE="JScript"> <!-- function VBArrayTest(vbarray) { var a = new VBArray(vbarray); var b = a.toArray(); var i; for (i = 0; i < 9; i++) { document.writeln(b[i]); } } --> </SCRIPT> </HEAD> <BODY> <SCRIPT LANGUAGE="JScript"> <!-- VBArrayTest(CreateVBArray()); --> </SCRIPT> </BODY>
JScript ランゲージ リファレンス、test メソッド
WScript.Echo(/\w/.test("foo")); if (/\w/.test("foo")) { WScript.Echo("then"); } else { WScript.Echo("else"); } WScript.Echo(/\d/.test("foo"));
JScript ランゲージ リファレンス、tan メソッド
WScript.Echo(Math.tan(0)); WScript.Echo(Math.tan(Math.PI/4));
JScript ランゲージ リファレンス、sup メソッド
WScript.Echo("foo".sup());
JScript ランゲージ リファレンス、substring メソッド
substr, substring というちょっと紛らわしい使い分け…
WScript.Echo("foo".substring(0,1)); WScript.Echo("foo".substring(1,0)); WScript.Echo("foo".substring(0,0)); WScript.Echo("foo".substring(4,5)); WScript.Echo("foo".substring(-1,1));
JScript ランゲージ リファレンス、substr メソッド
WScript.Echo("foo bar".substr(0)); WScript.Echo("foo bar".substr(1)); WScript.Echo("foo bar".substr(1, 4)); WScript.Echo("foo bar".substr(1, 10)); WScript.Echo("foo bar".substr(10)); WScript.Echo("foo bar".substr(1, -1));