我在名为' data'
的javascript变量中有以下值"Order","Id","Comment","Id_type"
"6","12321","www","Industry"
"4","32321","www","country"
每行后都有回车符。我怎么能用逗号替换它?
我尝试使用正则表达式,但它在chrome中说错误
Uncaught SyntaxError: Invalid regular expression: missing /
这是我用来用逗号替换回车的代码。请咨询。
data= data.replace(/\r/g,',');
答案 0 :(得分:0)