Consider following code snippet:

var s = 'myteststring';
console.log(s.split(',', 6));
What will be printed to the console?
Explanation
The split() method is used to split a string into an array of substrings, and returns the new array.

string.split(separator, limit);
Both parameters are optional. Separator specifies the character to use to split the string. Limit specifies the number of splits.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback