I have some text which looks like this -
\" tushar is a good boy \"
Using javascript I want to remove all the extra white spac
Since everyone is complaining about .trim(), you can use the following:
.trim()
str.replace(/\s+/g,' ' ).replace(/^\s/,'').replace(/\s$/,'');
JSFiddle