正则表达式: var s = document.getElementById(“username”).value;如果s ==“\ \ \ \”; var result = s.replace(/ \/g,“”)会出错吗?为什么那个萤火虫错误?JavaScript替换字符串
希望结果等于== “”,但萤火虫是输出:
的SyntaxError {源= “与(_FirebugCommandLine){(” \ \“)代替(/(\)/克。 “”); \ n};“,message =”未终止的字符串文字“,fileName =”resource://firebug_rjs/console/commandLineExposed.js“,更多......}
为什么?请帮帮我?
@kevin彭,你想达到什么目的? – Nivas