var s1 = "The play's the thing"; var s2 = s1.splice(4,8); // s2 = "play"
You can carve a string into substrings using
.splice(start, end) by specifying the starting index and the ending index. The section of the string starting with the character at the index specified by
start and ending with the character just before
end index is returned. All indexes are zero based.