![]() ![]() In the second call, we specified a limit of 2 as well as a space delimiter character. ![]() In this example, the split() method returned an array of 4 elements consisting of the strings 'Tech', 'On', 'The', and 'Net'. In the first call, we used a space character as the delimiter. The following will be output to the web browser console log: We have written the output of the split() method to the web browser console log, for demonstration purposes, to show what the split() method returns. We have then invoked the split() method of the totn_string variable to break the string into an array of strings using a delimiter. In this example, we have declared a variable called totn_string that is assigned the string value of 'Tech On The Net'. Let's take a look at an example of how to use the split() method in JavaScript.įor example: var totn_string = 'Tech On The Net'
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |