One: JS supports the Unicode character set, so you can use the Chinese name function.
Two: JS in Var has not initialized the variable, the default is undefined
Third: For variables that are not declared and unassigned, if used directly, a system-level error is thrown, and if TypeOf (TypeOf is a type operator), the string "undefined" is returned, whether or not it has been declared;
Cases:
A not stated
Alert (typeof (a));//undefined
alert (a);//error
IV: Arithmetic operators. With "+" you can easily convert a number to a string, the action is the operation is to add this value to an empty string (also can not write).
Cases:
Var a=2.96;
Var b=1.0;
Alert (+ "" +b);//Get String "2.961"
Use "-" to replace a string with a numeric value by subtracting the string by a value of 0
Var a= "2.96";
alert (a+1);//Get String "2.961" (cast numeric value to string)
alert (a-0+1);/Get a value of 3.96
Here's a example I do:
Copy Code code as follows:
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/>
<title>js</title>
<script language= "JavaScript" >
x=5+5;
document.write (x+ "<br>");
x= "5" + "1";
document.write (x+ "<br>");
x= "5" +5;
document.write (x+ "<br>");
x= "10"-5;
document.write (x+ "<br>");
</script>
<body>
</body>
Results:
10
51
55
5