Tham chiếu toàn cầu về JavaScript
Các thuộc tính và phương thức toàn cục của JavaScript có thể được sử dụng với tất cả các đối tượng JavaScript.
Các phương thức toàn cầu của JavaScript
Function | 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 |
isFinite() | Determines whether a value is a finite, legal number |
isNaN() | Determines whether a value is an illegal number |
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 |
unescape() | Deprecated. Use instead: decodeURI() decodeURIComponent() |
Thuộc tính toàn cầu của JavaScript
Property | Description |
---|---|
Infinity | A numeric value that represents positive/negative infinity |
NaN | "Not-a-Number" value |
undefined | Indicates that a variable has not been assigned a value |
Ghi chú
Vì các phương thức này là toàn cục và đối tượng chung là cửa sổ trình duyệt, các phương thức này thực sự là phương thức cửa sổ:
isNaN () giống như window.isNaN ().