js replace back and forward slashes regex code example
Example 1: replace backward slash in javascript
const data = { "\\id\\": "\\23232\\", "\\pass\\": "\\1434\\" };
console.log(data);
const b = JSON.stringify(data);
str = b.replace(/\\/g, '');
console.log(str);
Example 2: javascript regex escape forward slash
// use a backslash to escape reserved characters including the forward slash
/\//