How can I replace a plus sign in JavaScript?

I need to make a replace of a plus sign in a javascript string. there might be multiple occurrence of the plus sign so I did this up until now:

myString= myString.replace(/+/g, "");#

This is however breaking up my javascript and causing glitches. How do you escape a '+' sign in a regular expression?

myString = myString.replace(/\+/g, "");

You need to escape the + as its a meta char as follows:

myString= myString.replace(/\+/g, "");

Once escaped, + will be treated literally and not as a meta char.

I prefer this:

myString.replace(/[+]/g, '').

you should escape your + sign, \+

myString.replace(/\+/g, "");