<!doctype html>
<meta charset= "Utf-8" >
<title> Untitled Document </title>
<script type= "Text/javascript" >
//javascript Inner class, number class
var num=new number (12.3456);
document.write (num.tofixed (2));
document.write ("<br>" +number.min_value);
//javascript Inner class, math class
var ma=90.1;
Rounding down
document.write ("<br>" +math.floor (49.5));
Rounding up
document.write ("<br>" +math.ceil (13.2));
document.write ("<br>" +math.random (Math.random () *100));
//javascript inner class, date class
var mydate=new Date ();
document.write ("<br>" +mydate.tolocalestring ());
document.write ("<br>" + (Mydate.getmonth () +1));
//javascript inner class, String class
var txt= "H Han llo China";
document.write ("<br>" +txt.indexof ("Worldr"));
var arr=txt.split ("");
document.write (arr);
var sub=txt.substr (3,3);
var sub=txt.substring (0,2);
var sub=txt.charat (3);
//javascript inner class, array class
arr[0]=12;
arr[1]= "Hello";
Arr[2]= "China";
Delete 2nd Element--Subscript 1
The first 1 indicates the deletion of the element, and the second 1 means the deletion of a
Arr.splice (a);
Modify the second "Hello", "World"
Update
Arr.splice ("World");
Put a new data "Beijing", added to the 1th element behind
Arr.splice (1, 0, "Beijing");
for (var key in arr) {
document.write (arr[key]+ "<br>");
}
</script>
<body>
</body>
These kinds of classes are very important, it is necessary to read the manual, it is written here are common usage.
Copyright Notice: Bo Master original articles, reproduced please indicate the source. Http://blog.csdn.net/dzy21
Common internal classes for JavaScript