JS Global function

Source: Internet
Author: User
Tags alphabetic character

The following 7 global functions are included in JavaScript to accomplish some common functions (which may be used in later chapters):
Escape (), Eval_r (), Isfinite (), IsNaN (), parsefloat (), parseint (), unescape ().
1. Escape ()
The Escape () function takes a string object or expression as a parameter and returns a String object. parameter specifies that all non-words in the string
The female character is converted to an equivalent number represented by XX%, and XX is a hexadecimal number that represents a non-alphabetic character.
2. Eval ()
The eval () function executes a string that contains a JavaScript statement passed through the parameter as a JavaScript source code. Eval
Returns the return value of the executing JavaScript statement.
For example, when you write cross-browser code, you can use the following code snippet:
<script type= "Text/javascript" >
Eval ("X=10;y=20;document.write (x*y)")
document.write (eval ("+ +)")
var x=10
document.write (eval (x+17))
</script>
3. Isfinite ()
The Isfinite () function is used to determine if a variable is bounded and returns true if bounded, otherwise false. The so-called bounded refers to expressions
The value bounds between Max_value and Min_value.
4. IsNaN ()
The IsNaN () function is used to determine whether a variable is NaN and, if so, returns True, otherwise false. NaN represents not a
Number, which represents a non-count, which is not any number.
For example, IsNaN (12) returns False,isnan (' a ') return True,isnan (True) to return False (because true at this time is treated as a number
1).
5. Parsefloat ()
The parsefloat () function is used to decompose an integer or floating-point number at the beginning of a string, or to return NaN if the string does not begin with a digit.
6. parseint ()
The parseint () function is similar to the parsefloat () function to break up an integer at the beginning of a string if the string does not start with a number
, a NaN is returned.
For example, if you use parseint instead of all the parsefloat in the parsefloat () function example just now.
7. ()
The () function converts the hexadecimal code in the string passed by the argument to the ASCII code and returns it, completing the inverse of the escape () function.
Operation. For example, the return value ("Tom & and Jerry Show") is "Tom & Jerry Show."

JS Global function

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.