The example of this article describes the use of JS common system functions. Share to everyone for your reference.
The specific code is as follows:
Copy Code code as follows:
<body>
<script type= "Text/javascript" >
1. The Escape () function, which turns the string into a universal Unicode encoding for each computer platform, and decodes (turns back) with Enescape ().
var str = ' Wang Meixin ';
document.write (Escape (str));
document.write ("<br/>");
2. The string is converted to an integral type or converted to a floating-point type. If the original string age does not begin with a number, the result is Nan.
var age = "26.9hellow world";
document.write (parseint (age));//parseint () function
document.write ("<br/>");
document.write (parsefloat (age));//parsefloat () function
document.write ("<br/>");
3. Judge a value/variable value, not non-numeric.
var num = "30.9ABC";
if (isNaN (num)) {
document.write ("num is a non-numeric");
}else{
document.write ("num is a number");
}
document.write ("<br/>");
4. Judge a value/variable value, is not there a poor
var result = 10/0;
if (isfinite (result)) {
document.write ("The value of the result variable is poor");
}else{
document.write ("The value of the result variable is infinite");
}
</script>
</body>
I hope this article will help you with your JavaScript programming.