无法与"\"在js中 [英] Cannot split with " \ " in js

查看:270
本文介绍了无法与"\"在js中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用.split('\')拆分数据,但是它不起作用,发生错误未捕获的SyntaxError:无效或意外的令牌".

i am trying to split my data using .split('\'), but its not working an error occurs "Uncaught SyntaxError: Invalid or unexpected token".

我们可以用'\'分割吗?

can we split with '\'?

推荐答案

您应该在此处拆分字符串,因为您需要转义\(字符串->双引号).

You should just split on a String here because you need to escape the \ (String -> double quotes).

所以.split("\\")是.

这篇关于无法与"\"在js中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆