我试着用糖。以前我在一年前使用过它,并且效果很好:
> npm install sugar
test@1.0.0 D:\work\test\test
`-- sugar@2.0.4
> node
>> require('sugar');
{ [Function: Sugar]
.....
Array:
{ [Function: SugarChainable]
.....
compact: [Function: compact],
....
>> [1,null,2,undefined,3].compact()
TypeError: [1,null,2,undefined,3].compact is not a function
at repl:1:24
at ContextifyScript.Script.runInThisContext (vm.js:23:33)
at REPLServer.defaultEval (repl.js:339:29)
at bound (domain.js:280:14)
at REPLServer.runBound [as eval] (domain.js:293:12)
at REPLServer.onLine (repl.js:536:10)
at emitOne (events.js:101:20)
at REPLServer.emit (events.js:191:7)
at REPLServer.Interface._onLine (readline.js:241:10)
at REPLServer.Interface._line (readline.js:590:8)
有什么想法现在有什么问题吗?