Array method:
Operation of the simulation queue: Push ()/shift (); Unshift ()/pop (); Analog stack operation: Push ()/pop (); Push () returns the added length and unshift. Pop and Shift return item values. Concat () returns an array based on an existing array, that is, an array is passed in, and it also changes the array to a single parameter. Reverse () is not used, join () returns the array as a delimiter in the form of a string. Split of the string can return an array.
Slice can be found on strings and arrays, slice (n,n+p), and P is the number of copies. The array is given an array, which is an empty array, and this method can handle negative numbers. The character's substring () can be copied, but not array-supported, not recommended. Splice () returns an array that affects the original array, can be modified, added, inserted into an array, and is inefficient. Sort () is based on the encoding size by default and can be thought of as a convenient comparison.
Number's method:
toString (). This method outputs numbers in a binary-based manner. There is a bug in the implementation. If an integer is going to go wrong (the following are the same way), but if the floating-point number is not a problem. There is no problem in the existing variable, so it is best to exist in the variable.
such as: 23.toFixed (3) error, and 23. ToFixed (3) can be used.
Toexponential () outputs a string in scientific notation, which specifies the number of digits after the decimal point (0-20 bits). There is the possibility of using the digital direct method.
ToFixed () specifies the number of digits after the decimal point output.
Toprecision () Specifies the total number of digits.
Regular expression methods:
Test ()/exec (); test () does not recommend the use of G-flag. EXEC () works, but slowly (captures slower). EXEC () returns an array with index0 as a match, followed by a capture group, index, input. Do not use the global identity to match only the first time. The G-ID will always be down, but only one match at a time.
Operation of the string:
Strings are the most common operations. CharAt ()/charcodeat ()/string.fromcharcode () string. Concat () stitching. It is recommended to use "+".
Query: IndexOf (text,position)/lastindexof () specifies the string and start position, returns the position, the query does not return-1. Search (exp) uses regular expressions, ignores G-flag, and returns the position.
Match () returns an array that does not have g with the Exec () method without g in the regular expression, and G will have a return match. A in replace (A, b) can be a string, a regular expression. B can be a function, which can be a string. Similarly, if you do not bring g, only the first item is matched. $ has a special meaning when it is a string. When you use a function, the first parameter passed in is a match, followed by a capture group.
Split () can be a string, regular expression. is a regular expression, the capturing group joins the array.
JS Pristine (method)