Copy codeThe Code is as follows:
/* Array */
Array. reverse () // sorts the Array in reverse order and changes it to a new Array.
Array. sort () // sorts the Array by characters and changes it to a new Array.
S = Array. push ("str1", "str2") // Add an Array from the back. s is the Add record.
S = Array. pop () // Delete the Array from the back, and s is the deleted record
S = Array. shift () // Delete the Array from the front, and s is the deleted record
S = Array. unshift ("str1", "str2") // Add an Array from the front. s is the Add record.
S = Array. splice (, "aa", "bb") // Delete two arrays from behind the third Array, and add a new Array at this position. S: Add record
S = Array. slice (2, 4) // starts from the second end of the Array and obtains the fourth value. The Array itself has not changed.
S = Ar1.concat (Ar2) // Add array Ar2 to array Ar1 to generate a new array s.
S = Array. join ("#") // concatenate Array elements with # To form a string and return it to s.
/* Function */
Sample: function Test (arg1, arg2)
Use: Test ("ddd", "sss", "fff ")
// Test. arity: // number of parameters set by the function (return value ).
Test. length: // number of parameters set by the function (return value ).
Test. caller: // call the Test () function (returned function, supported by IE ).
Test. apply (obj, [arg1, arg2]) // make the specified object (obj) have the attributes and methods of Test.
Test. call (obj, arg1, arg2) // make the specified object (obj) have the attributes and methods of Test.
Arguments: // The number of actually passed parameters (returned array ).
Arguments. callee: // The currently executed function (return function ).
(New Test). constructor: // view the structure (return function) of the new instance (Test ).
/* String */
Str. slice (3,-5) // start from the end of the third string and obtain the-5 (the fifth to the last. Parameter 2 must be greater than parameter 1 or be negative ).
Str. substring (6th) // starts from the end of the third string and obtains values.
Str. substr () // starts after the third string and takes 6 Characters backward.
Str. charCodeAt (4) // returns the 10-digit encoding of the 5th strings.
Str. charAt (4) // returns 5th strings.
Str. toLowerCase () // convert all to lowercase characters.
Str. toUpperCase () // All are converted to uppercase/lowercase characters.
Str. split (",") // use "," to split the string and return an array.
Str. search ("aaa") // finds the position of aaa in the string, which is generally used together with a regular expression.
Str. indexOf ("aaa") // locate the position of aaa in the string.
Str. lastIndexOf ("aaa") // search for the position where "aaa" appears in the string.
Str. match ("aaa") // extracts "aaa" from Str, returns null or an array, which is generally used together with a regular expression.
Str. replace ("aaa", "bbb") // replace the first "aaa" with "bbb", which is generally used together with a regular expression.
String. fromCharCode (39080) // returns a 10-digit encoded character.
Str1 = str2.concat (str3) // Add str3 to str2 to generate a new string str1.