javascript chrome 控制台中的 ?-character 是什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21572938/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is the ?–character in chrome console?
提问by Himmators
I'm pulling in some data from an api and console.log in chrome:
我正在从 chrome 中的 api 和 console.log 中提取一些数据:
Chrome prints it like asdf?klajsd?New line!
Chrome 打印它像 asdf?klajsd?New line!
I would like to replace the ? character with a <br />
using replace
in javascript. How do I reference that character?
我想更换?在 javascript 中<br />
使用的字符replace
。我如何引用该字符?
回答by Cerbrus
It's a return character.
这是一个返回字符。
Try replacing them like this:
尝试像这样替换它们:
myString = myString.replace(/(\r\n|\n|\r)/gm, "<br />");