相关疑难解决方法(0)

反引号调用函数

我不知道如何解释这个,但是当我跑步时

console.log`1`
Run Code Online (Sandbox Code Playgroud)

在谷歌浏览器中,我得到的输出就像

console.log`1`
VM12380:2 ["1", raw: Array[1]]
Run Code Online (Sandbox Code Playgroud)

为什么反引号调用日志函数,为什么它的索引是raw: Array[1]

Catgocat在JS房间里提出了一个问题,但除了一些关于模板字符串的内容之外没有任何答案是有意义的,因为这些字符串并不真正适合发生这种情况的原因.

javascript ecmascript-6 template-strings template-literals tagged-templates

73
推荐指数
3
解决办法
1万
查看次数