目录

JavaScript 全局参考

JavaScript 全局属性和方法可与所有 JavaScript 对象一起使用。

JavaScript 全局方法和属性

Name Description
decodeURI() Decodes a URI
decodeURI
Component()
Decodes a URI component
encodeURI() Encodes a URI
encodeURI
Component()
Encodes a URI component
escape() Deprecated. Use instead:
encodeURI()
encodeURIComponent()
eval() Evaluates a string and executes it as if it was script code
Infinity A numeric value that represents positive/negative infinity
isFinite() Determines whether a value is a finite, legal number
isNaN() Determines whether a value is an illegal number
NaN "Not-a-Number" value
Number() Converts an object's value to a number
parseFloat() Parses a string and returns a floating point number
parseInt() Parses a string and returns an integer
String() Converts an object's value to a string
undefined Indicates that a variable has not been assigned a value
unescape() Deprecated. Use instead:
decodeURI()
decodeURIComponent()

笔记

由于这些方法是全局的,而全局的对象是浏览器窗口,因此这些方法实际上是窗口方法:

isNaN() 与 window.isNaN() 相同。