function slashEscape(strVar){
var retVal = strVar;
retVal = retVal.replace(/\\/g,"\\\\");
return retVal;
}
I use that function to escape the slashes in a certain string. But the result is not right.
var str = slashEscape("\t \n \s");
It will result to "s" instead of "\t \n \s"
\tis a tab character. Your function probably should not exist; what are you trying to do?