Back
How do I split a string with multiple separators in JavaScript?
You can use regular expression as a parameter of split function like this:
var s=”Hello awesome world!”.split(/[\s,]+/)console.log(s)
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.
31k questions
32.8k answers
501 comments
693 users