Eddie Costa Domingues Eddie Costa Domingues - 5 months ago 9
Javascript Question

Javascript how to split() multiple string or values?

So for example I want to use the split() method on these characters

"{"
&
"}"
and the string that I'm going to split looks like this
"{99}"

wot wot
Answer

Do you want to remove those characters or split on those characters to form an array? Your question is confusing and you should consider re-phrasing it.

If you want to remove them:

console.log("{99}".replace(/[{}]/g, "")) /* "99" */

If you want to split on them:

console.log("{99}".split(/[{}]/g)) /* ["", "99", ""] */