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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 21:13:32  来源:igfitidea点击:

What is the ?–character in chrome console?

javascriptgoogle-chrome

提问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 replacein 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 />");