Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Web Technology by (7k points)

How do I split a string with multiple separators in JavaScript?

1 Answer

0 votes
by (13.1k points)

You can use regular expression as a parameter of split function like this:

var s=”Hello awesome world!”.split(/[\s,]+/)

console.log(s)

Want to be a full stack developer? Check out the full stack developer course from Intellipaat. 

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...