This is the answer according to the heading, as the heading is " Delete all slashes in Javascript " and not the backslash. So, here is the code to remove all slashes from a string in JavaScript.
str = '/mobiles-phones/.png';
str.replace(/\//g, "")//output would be "mobiles-phones.png";
source
share