In all the js are the object; strings, arrays, numerical, function ......
Built-in object has its own properties and methods, access methods as follows:
Object name attribute name.;
Object Name. Method Name
1.Array array of objects
unshift () beginning of the array increases
Function: to increase the beginning of an array of one or more
Parameters: One or more
Return Value: length of the array
Change the original array
shift () deletes a beginning of an array
Function: to delete a beginning of an array
Parameters: None
Returns: what was deleted
Change the original array
Increasing the end of the array push ()
Function: to increase one or more of the end of the array
Parameters: One or more
Return Value: length of the array
Change the original array
Delete one end of the array pop ()
Function: to delete the end of the array is not a
Parameters: None
Returns: what was deleted
Change the original array
concat () splice array
ary1.concat( ary2,ary3....)
Concat may be implemented using an array of clones, concat () does not pass the parameters
splice(index, howmany, item1, ...itemx)
splice can remove a parameter array implementation, additions, substitutions
The first two parameters and index howmany are required parameters, optional parameters parameters of the back
splice (index, 0, item1, item2 ...) increase
Increased from index index, additions inserted in front of the index index
splice (index, n) deleted
Beginning removed from the index index n a, if only one parameter splice (index), is to delete all start from the back of the index index content
splice (index, n, item1, item2 ...) replacement
Index index began to replace the n replace content for item1, item2 ....
slice (n, m) interception
Taken from the index n to the index m but not m, the original array is not changed
slice (0) or splice () clone arrays can be achieved
reverse () array flip
The return value is the new array flipped, the original array is changed
sort () to sort an array
Usage: sort (function (a, b) {return ab}) from small to large
sort (function (a, b) {return ba}) descending row
toString () array to a string
The array to a comma delimited string into
join (spliced forms) splicing
Dividing the array into a string of splicing in other forms, with the eval () may be implemented mathematical operation eval (join ( '+'))
But is not compatible with an array of commonly used methods:
indexOf (Find what) Find
ary.indexOf (Find what) to find out whether there is an array, any return of the item quoted, then no return -1;
forEach () traversal
forEach accepts two parameters, a callback, thisArg
callback three parameters:. 1) Item 2) index. 3) INPUT
thisArg used to change the callback this point;
forEach no return value, the return value map but
map () traversal
2.string string
charAT (index) to find characters by index
charCodeAt (index) to find Unicode character encoding by the index. The return value is 0 - integer between 65535.
The method of the charCodeAt () and the charAt () method is similar to the operation performed, but the former is returned at the specified position of the character encoding, which returns a character string.
indexOf () from front to back looking to find the contents of the index return, could not find return -1;
lastIndexOf () forward looking after, returns the contents of the index to find, can not find return -1;
slice (n, m) from a lookup index n to the index m but not including m, slice may be negative
substring (n, m) Find the index n to the index m, excluding m, may not take a negative value
substr (n, m) from the m index n to intercept a
split (cleaved form) the string into a string array.
toUpperCase () turn uppercase letters
the toLowerCase () turn lowercase
3.Math objects
Math.floor () rounds down
Math.ceil () rounding up
Math.random () to take a random decimal between 0-1
Math.round () rounding
Math.abs () absolute value
Math.pow (X, y) X power of y
Math.sqrt () square root
Math.max () takes the maximum value
Math.min () takes a minimum value
4.Date date object
new Date () Creates a date object
getFullYear () Returns the year
getMonth () returns the number (0-11) months, want to get a few months, we need to add a
getDay () returns the first days of the week (0-6), want to get a few weeks, we need to add a
getDate () Returns the day
getHours () returns
getMinutes () Returns points
the getSeconds () Returns the seconds
getTime () returns from at 00:00 on January 1, 1970 to the present number (GMT) ms, which is the timestamp
setYear (yearInt) disposed .2 year or 4 digits
setFullYear (yearInt) set the year .4-digit
setMonth (monthInt) set the month (0-11)
setDate (dateInt) set the day (1-31)
setHours (hourInt) Set Number (0-23) hours
setMinutes (minInt) Set Number (0-59) minutes
setSeconds (secInt) set (0-59)
setMilliseconds (milliInt) disposed milliseconds (0-999)