I have:
var foo = \'(bar)\' foo.replace(\'(\', \'\').replace(\')\', \'\')
So, I get bar without parentheses, is there a better
bar
You could use:
foo = foo.replace(/[()]/g, '');
That involves a simple regular expression that matches all instances of either open- or close-parentheses. Note that you have to include that assignment, as ".replace()" does not modify the string; it returns the modified string.