Underscore: ReferenceError: _ 未定义

创建于 2018-01-26  ·  5评论  ·  资料来源: jashkenas/underscore

在安装下划线时遇到一些麻烦(因为它不是 underscore.js,而只是下划线),我尝试使用下划线函数 (_.once) 但我收到此错误,我的代码顶部有const Underscore = require("underscore") ,但是,当我尝试const Underscore = require("underscore.js")时,它没有找到模块,所以请您赐教?

我是 JavaScript 的真正初学者,如果我做了明显错误的事情,请原谅我;p

最有用的评论

您的代码将下划线库分配给名为Underscore的常量。
我想你想要的是: const _ = require("underscore");它将下划线库分配给一个名为_的常量。

所有5条评论

您的代码将下划线库分配给名为Underscore的常量。
我想你想要的是: const _ = require("underscore");它将下划线库分配给一个名为_的常量。

天哪,谢谢,因为我没有上过任何 javascript 课程,所以我不明白这个命令的真正含义,但现在我明白了,谢谢:D

您的代码将下划线库分配给名为Underscore的常量。
我想你想要的是: const _ = require("underscore");它将下划线库分配给一个名为_的常量。

找了好几个小时...

您的代码将下划线库分配给名为Underscore的常量。
我想你想要的是: const _ = require("underscore");它将下划线库分配给一个名为_的常量。

谢谢你。 这在您处理 React 应用程序时也有效。

您的代码将下划线库分配给名为Underscore的常量。
我想你想要的是: const _ = require("underscore");它将下划线库分配给一个名为_的常量。

非常感谢

此页面是否有帮助?
0 / 5 - 0 等级

相关问题

zackschuster picture zackschuster  ·  5评论

xiaoliwang picture xiaoliwang  ·  3评论

jezen picture jezen  ·  8评论

dmaicher picture dmaicher  ·  9评论

clouddueling picture clouddueling  ·  3评论