How to replace all spaces present in a string with underscore using javascript? : <p>I have a string with spaces separating words. I want to replace all the spaces in the string with underscore. Please tell me any small code for that because my solution is taking too much space.
Example : 'Divyanshu Singh Divyanshu Singh'
output : 'Divyanshu_singh_Divyanshu_Singh'</p>
