Remove all backslashes in Javascript
This is the answer according to the title as the title is "Remove all slashes in Javascript" not backslashes. So here is the code to remove all the slashes from a string in JavaScript.
str = '/mobiles-phones/.png';
str.replace(/\//g, "")//output would be "mobiles-phones.png";
Use a simple regex to solve it
str = str.replace(/\\/g, '')
Demo: Fiddle
Regexs are great str.replace(/\\/g,'')