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