If it is not provided, the substring will consist of the start index all the way through the end of the string. In all cases, the second argument is optional. To clear up my own confusion and misconceptions, I wanted to take a quick look at the various ways in which Javascript allows for partial string extraction.įrom what I can see, there are three primary methods for substring extraction: When I think of slice(), I think of extracting portions of a Javascript array I don't think I was even aware that the Javascript String prototype had a slice() method. And, in his examples, Haverbeke makes frequent use of the String method, slice(). In the book, Eloquent Javascript: A Modern Introduction to Programming, Marijn Haverbeke takes the reader through a good number of string-parsing examples.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |