Just change your two replaces to this:
var newstr=str.replace(/[+-]/g,"");
solved How do I replace all occurrences of + – with javascript? [closed]
 
Just change your two replaces to this:
var newstr=str.replace(/[+-]/g,"");
solved How do I replace all occurrences of + – with javascript? [closed]