August 1999
Intermediate to advanced
1488 pages
72h 53m
English
string.slice(num1, num2) string.slice(num)
The slice() method of an instance of the String object returns the characters in the string between the indexed positions num1 and num2 in which the method is invoked. The string itself is zero based, so the first character is in position 0. It is also possible to pass num2 as a negative number. In this scenario, the string counts from the end of the string to end the slice.
As the syntax definition states, it is also possible to pass a single index location to the method. In this implementation, the method will not stop at a position and will return all characters until the end of the string.
Read now
Unlock full access