Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the global functions in javascript

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains "what are the global functions in javascript". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn what the global functions in javascript are.

DecodeURI () function

The decodeURI () function decodes the URI encoded by the encodeURI () function.

Syntax: decodeURI (uri)

Uri: required. A string containing the URI or other text to be decoded.

DecodeURIComponent () function

The decodeURIComponent () function decodes the URI encoded by the encodeURIComponent () function.

Syntax: decodeURIComponent (uri)

EncodeURI () function

The encodeURI () function encodes the string as URI.

The encodeURI () function does not escape the following ASCII punctuation marks that have a special meaning in URI: /?: @ & = + $# (you can use the encodeURIComponent () method to encode ASCII punctuation marks with special meaning respectively.) .

Syntax: encodeURI (uri)

EncodeURIComponent () function

The encodeURIComponent () function encodes the string as a URI component.

This method does not encode ASCII letters and numbers, nor does it encode these ASCII punctuation marks:-_. ! ~ * ().

Other characters (such as: /?: @ & = + $, #, the punctuation marks used to separate URI components) are replaced by one or more hexadecimal escape sequences.

Syntax: encodeURIComponent (uri)

Escape () function

The escape () function encodes a string so that it can be read on all computers.

This method does not encode ASCII letters and numbers, nor does it encode the following ASCII punctuation marks: * @-_ +. / . All other characters are replaced by escape sequences.

Syntax: escape (string)

String: required. The string to be escaped or encoded.

Eval () function

The eval () function evaluates the JavaScript string and executes it as script code.

If the parameter is an expression, the eval () function executes the expression. If the argument is a Javascript statement, eval () executes the Javascript statement.

Syntax: eval (string)

IsFinite () function

The isFinite () function is used to check whether its argument is infinite, or it can be understood as a finite number (finite number).

Syntax: isFinite (value)

Value: required. The number to be detected.

Return value: if the parameter is NaN, positive infinity or negative infinity, false will be returned, and other parameters will return true.

IsNaN () function

The isNaN () function is used to check whether its parameters are non-numeric.

Syntax: isNaN (value)

Returns true if the parameter value is NaN or non-numeric values such as string, object, undefined, etc., otherwise it returns false.

Number () function

The Number () function converts the value of an object to a number.

Syntax: Number (object)

If the value of the object cannot be converted to a number, the Number () function returns NaN.

ParseFloat () function

The parseFloat () function parses a string and returns a floating point number.

This function specifies whether the first character in the string is a number. If so, the string is parsed until the end of the number is reached, and then the number is returned as a number, not as a string.

Syntax: parseFloat (string)

ParseInt () function

The parseInt () function parses a string and returns an integer.

Syntax: parseInt (string, radix)

When the value of the parameter radix is 0, or when it is not set, parseInt () determines the cardinality of the number based on string.

When the parameter radix is omitted, the cardinality of the default number for JavaScript is as follows:

If string starts with "0x", parseInt () parses the rest of the string into hexadecimal integers.

If string starts with 0, ECMAScript v3 allows an implementation of parseInt () to parse subsequent characters into octal or hexadecimal numbers.

If string starts with a number from 1 to 9, parseInt () parses it to a decimal integer.

String () function

The String () function converts the value of an object to a string.

Syntax: String (object)

Unescape () function

The unescape () function decodes a string encoded by escape ().

Syntax: unescape (string)

Note: unescape () cannot be used for selective decoding of URI (Universal Resource Identifier: UniformResourceIdentifier, referred to as "URI"). Use the decodeURI () method to decode the URI.

Thank you for your reading, the above is the content of "what are the global functions in javascript". After the study of this article, I believe you have a deeper understanding of what the global functions in javascript have, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report