Method of operating an array
You can change the original array method
push () to add something arbitrary bit end of the array; Returns an array of length after the change
Rewrite push method
//原型链上编程思想
var arr = [1,2,3];
Array.prototype.push = function() {
for(var i = 0; i <= arguments.length; i ++) {
this[this.length] = arguments[i];
}
}
//针对数组的方法 this指向调用该方法的数组
pop () cut the last bit array and returns the cut off value
shift () taken from the beginning of the array and a return value of the truncated
unshift () to add one in front of an array or as
sort()
Principle function parameters a, b are elements of the array in turn compares a
reverse () Returns the value of the original array reversal Note i.e. altered to change the original array
splice () method slice
It does not change the original array
concat () returns an array of links to two new array but does not change the original array
toString () array becomes a string
It does not change the original array so concerned about the return value
join () method standard syntax parameter string but also the line number
split () method to join the string into the array is a pair of strings to achieve conversion and Array
Note relatively split () method parameters, the difference