为什么字符串中的反斜杠(\)在控制台中给出错误 [英] why backslash(\) in a string is giving error in console
本文介绍了为什么字符串中的反斜杠(\)在控制台中给出错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个字符串
"C:\projects\cisco\iwan_staging_enc\enterprise-network-controller\ui-plugins\iwan"
当我粘贴到控制台时
并按Enter,它给出以下错误,例如
when i paste into console
and press enter, it is giving following error as
Uncaught SyntaxError: Invalid Unicode escape sequence
这里出了什么问题
谢谢
nageshwar
nageshwar
推荐答案
由于反斜杠是转义字符,因此您的字符串应修改为:
Since backslash is an escape character your string should be modified to:
"C:\\projects\\cisco\\iwan_staging_enc\\enterprise-network-controller\\ui-plugins\\iwan"
这篇关于为什么字符串中的反斜杠(\)在控制台中给出错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文