Java script remove backslashes and forwardslashes from a string

How can I remove backslashes and forwardslashes from a string or remove forwardslash from a url using java script.I’m going to explain to do this by using regular expressions and simple core java script.

1-Remove Backslashes

Backslash (\)

2-Remove Forwardslashes

Forwardslash (/)

Note here is the regular expression /\//g and /\/$/. The piece of the string you want replacing is written between the first and last forward slashes.
If you wanted the word ‘book’ replaced you would write /book/g.

Published by

Sumith Harshan

Sumith Harshan is the Web Engineer Specializes in Java Script, JQuery, HTML4/5, CSS2/3, PHP, CodeIgniter, CakePHP, J2SE, J2EE, XML, Hacking & Security, Mobile Interface Developing, Magento, Wordpress, Joomla, Drupal,PHPBB,Facebook App Developing and Open cart...etc.