JavaScript built-in objects Array, String methods

  • Array
push () // one or more data is added to the end of the array, and returns the new length of the array. 
POP () // remove the last item in the array, the length property modification, and returns the data to be deleted 
shift () // take the first element in the array, the length property modifying 
the unshift () // prepend item in the array, return the array length 

Reverse () // array flip 
Sort () // Sort the array is even, and is based on the character , from small to large order 
// sort with parameters is how to achieve? 

concat () // splicing parameters to the current array 
slice () // current array taken from a new array, does not affect the original array, parameter start from zero, end starting from 1 
splice (start position, the number deleteCount the new element options ...) // remove or replace the current array of some items, parameters start, deleteCount, options (item to be replaced) 
// meaning of the above method is to remove from the position from the start deleteCount elements, with Alternatively new element option (option new elements can have many). 
All the elements join () // array method at a given string "series" is a string format. 

indexOf (), lastIndexOf () // find the character subscript, if not found returns -1 

Every (), filter (), forEach (), the Map (), some ()
  • String
Method 1 // character 
the charAt () // Get the specified character position 
the charCodeAt () // Get the specified position in the ASCII 

// string manipulation method 2 
the concat () // string concatenation, equivalent to +, + more usually 
slice (start, end) // starting from start position, end position to intercept, fail to end 
substring (start, end) // starting from start position, end position taken to end the reach 
substr (start, length ) // start position from the beginning, the interception length character 

// method 3 position of 
the indexOf () // returns the specified content in the meta position of the string, the method may set two parameters, .indexOf ( 'string looking for ', from a position P), 
                  // indicates the start looking for a specific string from a position p, if found, return to find the location, otherwise -1; if the second parameter is omitted, started looking from position 0 . 
lastIndexOf () // looking forward from the rear, only to find a match for the first 

// blank 4 is removed    
TRIM () // remove only empty before and after the character string (including spaces, carriage returns, line feeds, tab character ) 

// 5 case conversion method 
to (Locale) upperCase () // converts uppercase 
to (Locale) lowerCase () // converts lowercase 

// other 6
search () // substantially equivalent to match, it returns the value of the first matching position. If no match is found, -1 is returned 
replace () // for replacement substring matching, generally to replace only the first match, it returns the new string 
split () // with the specified character string segmentation an array                

 

Guess you like

Origin www.cnblogs.com/belongs-to-qinghua/p/11352763.html