版本信息

JScript 是一种不断演变的语言,每个新版本都引入一些新的功能。若要充分利用该语言的特定版本提供的所有功能,必须有兼容版本的编译器或脚本引擎。

当为服务器端应用程序或命令行程序编写代码时,它所支持的编译器版本和 JScript 版本通常是已知的。但是,当编写运行在浏览器脚本引擎中的客户端脚本时,运行的脚本将检测引擎版本。一旦知道了引擎版本,就可以运行使用兼容的 JScript 版本编写的脚本。有关更多信息,请参见检测浏览器功能

下表列出了宿主应用程序所实现的 Microsoft JScript 版本。

宿主应用程序 1.0 2.0 3.0 4.0 5.0 5.1 5.5 5.6 .NET
Microsoft Internet Explorer 3.0 x                
Microsoft Internet Information Server 3.0   x              
Microsoft Internet Explorer 4.0     x            
Microsoft Internet Information Server 4.0     x            
Microsoft Internet Explorer 5.0         x        
Microsoft Internet Explorer 5.01           x      
Microsoft Windows 2000           x      
Microsoft Internet Explorer 5.5             x    
Microsoft Windows Millennium Edition             x    
Microsoft Internet Explorer 6.0               x  
Microsoft Windows XP               x  
Microsoft Windows Server 2003               x  
Microsoft .NET Framework 1.0                 x

注意   ScriptEngineMajorVersion 函数和 @_jscript_version 条件编译变量所报告的版本号始终是数值。这样就允许对版本号执行数值比较。对于 .NET 版本的应用程序,所报告的版本为 7.x,而不是 .NET。这就意味着,报告版本号为 7.x 或更高的引擎可以编译 JScript .NET 代码。

下表列出了 JScript 语言功能和首次引入时的版本。

语言元素 1.0 2.0 3.0 4.0 5.0 5.5 .NET
0...n 属性           x  
$1...$9 属性     x        
abs 方法 x            
abstract 修饰符             x
acos 方法 x            
ActiveXObject 对象     x        
加法运算符 (+) x            
加法赋值运算符 (+=) x            
anchor 方法 x            
apply 方法           x  
arguments 对象 x            
arguments 属性   x          
Array 对象   x          
asin 方法 x            
赋值运算符 (=) x            
atan 方法 x            
atan2 方法 x            
atEnd 方法     x        
big 方法 x            
按位“与”运算符 (&) x            
按位“与”赋值运算符 (&=) x            
按位左移运算符 (<<) x            
按位“取非”运算符 (~) x            
按位“或”运算符 (|) x            
按位“或”赋值运算符 (|=) x            
按位右移运算符 (>>) x            
按位“异或”运算符 (^) x            
按位“异或”赋值运算符 (^=) x            
blink 方法 x            
bold 方法 x            
boolean 数据类型             x
Boolean 对象   x          
break 语句 x            
byte 数据类型             x
call 方法           x  
callee 属性           x  
caller 属性   x          
catch 语句         x    
@cc_on 语句     x        
ceil 方法 x            
char 数据类型             x
charAt 方法 x            
charCodeAt 方法           x  
class 语句             x
逗号运算符 (,) x            
//(单行注释语句) x            
/*..*/(多行注释语句) x            
比较运算符 x            
compile 方法     x        
concat 方法(数组)     x        
concat 方法(字符串)     x        
条件编译     x        
条件编译变量     x        
条件(三元)运算符 (?:) x            
const 语句             x
constructor 属性   x          
continue 语句 x            
cos 方法 x            
数据类型转换     x        
Date 对象 x            
@debug 指令             x
debugger 语句     x        
decimal 数据类型             x
decodeURI 方法           x  
decodeURIComponent 方法           x  
减量运算符 (--) x            
delete 运算符     x        
description 属性         x    
dimensions 方法     x        
除法运算符 (/) x            
除法赋值运算符 (/=) x            
do...while 语句     x        
double 数据类型             x
E 属性 x            
encodeURI 方法           x  
encodeURIComponent 方法           x  
enum 语句             x
Enumerator 对象     x        
相等运算符 (==) x            
Error 对象         x    
escape 方法 x            
eval 方法 x            
exec 方法     x        
exp 方法 x            
expando 修饰符             x
false 标识符 x            
final 修饰符             x
fixed 方法 x            
float 数据类型             x
floor 方法 x            
fontcolor 方法 x            
fontsize 方法 x            
for 语句 x            
for...in 语句         x    
fromCharCode 方法     x        
function get 语句             x
Function 对象   x          
function set 语句             x
function 语句 x            
getDate 方法 x            
getDay 方法 x            
getFullYear 方法     x        
getHours 方法 x            
getItem 方法     x        
getMilliseconds 方法     x        
getMinutes 方法 x            
getMonth 方法 x            
GetObject 函数     x        
getSeconds 方法 x            
getTime 方法 x            
getTimezoneOffset 方法 x            
getUTCDate 方法     x        
getUTCDay 方法     x        
getUTCFullYear 方法     x        
getUTCHours 方法     x        
getUTCMilliseconds 方法     x        
getUTCMinutes 方法     x        
getUTCMonth 方法     x        
getUTCSeconds 方法     x        
getVarDate 方法     x        
getYear 方法 x            
Global 对象     x        
global 属性           x  
大于运算符 (>) x            
大于或等于运算符 (>=) x            
hasOwnProperty 方法           x  
hide 修饰符             x
@if 语句     x        
if...else 语句 x            
ignoreCase 属性           x  
import 语句             x
in 运算符 x            
增量运算符 (++) x            
index 属性     x        
indexOf 方法 x            
不等运算符 (!=) x            
Infinity 属性     x        
input 属性 ($_)     x        
instanceof 运算符         x    
int 数据类型             x
interface 语句             x
internal 修饰符             x
isFinite 方法     x        
isNaN 方法 x            
isPrototypeOf 方法           x  
italics 方法 x            
item 方法     x        
JScript 数据类型             x
join 方法   x          
Labeled 语句     x        
lastIndex 属性     x        
lastIndexOf 方法 x            
lastMatch 属性 ($&)           x  
lastParen 属性 ($+)           x  
lbound 方法     x        
leftContext 属性 ($`)           x  
左移赋值运算符 (<<=) x            
length 属性(参数)           x  
length 属性(数组)   x          
length 属性(函数)   x          
length 属性(字符串) x            
小于运算符 (<) x            
小于或等于运算符 (<=) x            
link 方法 x            
LN2 属性 x            
LN10 属性 x            
localeCompare 方法           x  
log 方法 x            
LOG2E 属性 x            
LOG10E 属性 x            
逻辑“与”运算符 (&&) x            
逻辑“非”运算符 (!) x            
逻辑 OR 运算符 (||) x            
long 数据类型             x
match 方法     x        
Math 对象 x            
max 方法 x            
MAX_VALUE 属性   x          
message 属性           x  
min 方法 x            
MIN_VALUE 属性   x          
取模运算符 (%) x            
取模赋值运算符 (%=) x            
moveFirst 方法     x        
moveNext 方法     x        
multiline 属性           x  
乘法运算符 (*) x            
乘法赋值运算符 (*=) x            
name 属性           x  
NaN 属性(全局)     x        
NaN 属性(数字)   x          
NEGATIVE_INFINITY 属性   x          
new 运算符 x            
非恒等运算符 (!==) x            
null 标识符 x            
Number 数据类型             x
Number 对象   x          
number 属性         x    
Object 对象     x        
运算符优先级 x            
override 修饰符             x
package 语句             x
parse 方法 x            
parseFloat 方法 x            
parseInt 方法 x            
PI 属性 x            
pop 方法           x  
@position 指令             x
POSITIVE_INFINITY 属性   x          
pow 方法 x            
print 语句             x
private 修饰符             x
propertyIsEnumerable 属性           x  
protected 修饰符             x
prototype 属性   x          
public 修饰符             x
push 方法           x  
random 方法 x            
RegExp 对象     x        
正则表达式对象     x        
正则表达式语法     x        
replace 方法 x            
return 语句 x            
reverse 方法   x          
rightContext 属性 ($')           x  
右移赋值运算符 (>>=) x            
round 方法 x            
sbyte 数据类型             x
ScriptEngine 函数   x          
ScriptEngineBuildVersion 函数   x          
ScriptEngineMajorVersion 函数   x          
ScriptEngineMinorVersion 函数   x          
search 方法     x        
@set 语句     x        
setDate 方法 x            
setFullYear 方法     x        
setHours 方法 x            
setMilliseconds 方法     x        
setMinutes 方法 x            
setMonth 方法 x            
setSeconds 方法 x            
setTime 方法 x            
setUTCDate 方法     x        
setUTCFullYear 方法     x        
setUTCHours 方法     x        
setUTCMilliseconds 方法     x        
setUTCMinutes 方法     x        
setUTCMonth 方法     x        
setUTCSeconds 方法     x        
setYear 方法 x            
shift 方法           x  
short 数据类型             x
sin 方法 x            
slice 方法(数组)     x        
slice 方法(字符串)     x        
small 方法 x            
sort 方法   x          
source 属性     x        
splice 方法           x  
split 方法     x        
sqrt 方法 x            
SQRT1_2 属性 x            
SQRT2 属性 x            
static 修饰符             x
static 语句             x
全等运算符 (===) x            
strike 方法 x            
String 数据类型             x
String 对象 x            
sub 方法 x            
substr 方法     x        
substring 方法 x            
减法运算符 (-) x            
减法赋值运算符 (-=) x            
sup 方法 x            
super 语句             x
switch 语句     x        
tan 方法 x            
test 方法     x        
this 语句 x            
throw 语句         x    
toArray 方法     x        
toDateString 方法           x  
toExponential 方法           x  
toFixed 方法           x  
toGMTString 方法 x            
toLocaleDateString 方法           x  
toLocaleLowerCase 方法           x  
toLocaleString 方法 x            
toLocaleTimeString 方法           x  
toLocaleUpperCase 方法           x  
toLowerCase 方法 x            
toPrecision 方法           x  
toString 方法   x          
toTimeString 方法           x  
toUpperCase 方法 x            
toUTCString 方法     x        
true 标识符 x            
try...catch...finally 语句         x    
类型批注             x
类型转换             x
typeof 运算符 x            
ubound 方法     x        
uint 数据类型             x
ulong 数据类型             x
一元求非运算符 (-) x            
undefined 属性           x  
unescape 方法 x            
unshift 方法           x  
无符号右移运算符 (>>>) x            
无符号右移赋值运算符 (>>>=) x            
ushort 数据类型             x
UTC 方法 x            
valueOf 方法   x          
var 语句 x            
VBArray 对象     x        
void 运算符   x          
while 语句 x            
with 语句 x            

请参见

JScript 参考 | JScript .NET 的新增功能