在Node.js中使用Underscore模块
我一直在学习有关node.js和模块的信息,似乎无法让Underscore库正常工作……似乎我第一次使用Underscore中的函数时,它会覆盖_对象,结果是我的函数调用。有人知道发生了什么吗?例如,这是来自node.js REPL的会话: Admin-MacBook-Pro:test admin$ node > require("./underscore-min") { [Function] _: [Circular], VERSION: '1.1.4', forEach: [Function], each: [Function], map: [Function], inject: [Function], (...more functions...) templateSettings: { evaluate: /<%([\s\S]+?)%>/g, interpolate: /<%=([\s\S]+?)%>/g }, template: [Function] } > _.max([1,2,3]) 3 > _.max([4,5,6]) TypeError: Object 3 has no method 'max' at [object Context]:1:3 at Interface.<anonymous> …