31.0k views
9 votes
What happens when a string doesn’t include the separator that’s specified in the parameter of the split() method?

1 Answer

12 votes

Answer:

Nothing

Step-by-step explanation:

If a seperator value is provided as an argument within the split() method and the string does not include that value then the string will remain the same and will not be split. If no value is provided as an argument within the split() method, then the string that the method is being applied to will automatically be split in every space character (" ") that exists within it. This is the default value of split() when no argument is passed to it.

User Ebikeneser
by
3.7k points