Javascript Reference
Categories: String

javascript String slice( )

@March 15, 2008, 1:22 a.m.
slice( )Firefox/Netscape/NN 4 IE 4 ECMA 3  

slice(startPositionIndex, endPositionIndex])

  

Returns a substring of the current string. The substring is copied from the main string starting at the zero-based index count value of the character in the main string. If no second parameter is provided, the substring extends to the end of the main string. The optional second parameter can be another zero-based index value of where the substring should end. This value may also be a negative value, which counts from the end of the string toward the front.

 
Parameters
 
  • A zero-based integer indicating the position within the current string object to start copying characters.
  • A zero-based integer indicating the position within the current string object to end copying characters. Negative values count inward from the end of the string.
 
Returned Value

String.


Powered by Linode.