Summary of array Methods
Will change the original array
The push and unshift Methods return the length. If the value is added, the length is returned. If the value is increased, other elements are returned.
Pop, shift returns this element
Reverse returns this element
Splice (START, deletecount, additem...), delete and add from the original array, return the deleted Array
Returns a new array without changing the original array.
Concat, join, slice (START, end)
Remember that the three are new arrays, and the others will change the original array.
Summary of the sting Method
If the original value is not changed, a new string or other values are returned.
1. When the response is string.match(regexpwithout gnames and regexp.exe C (string), the result is the same.
If the g id is used, all matching arrays (except the capture group) are generated)
2. String. slice (START, end), the end parameter is equal to the position of the last character you want To take + 1. If you want to get the nth character starting from position P, use string. slice (p, p + n)
String. substring is the same as array. slice.
3. Regular Expressions can be used for replacement or grouping.
String. Split (separator, limit), limit can limit the number of segments to be split, and the regular expression has the same g
String. Replace (searcdhvalue, replacevalue), searcdhvalue if the regular expression contains g, all the matches will be replaced. If not, only the first match will be replaced.
If it is a string, the value is replaced in the first place where it appears
Take two months to sort out the JS knowledge.
Notes for Array and string Methods