Trying out Underscore on Node.js
Join the DZone community and get the full member experience.Join For Free
$ npm install underscoreThen you can use it in code as follows:
var _ = require("underscore");If you want to play with Underscore interactively in the Node.js REPL, you can’t give it the name _, because that is used by the REPL, to hold the previous input:
> 3 + 4 7 > _ 7Solution: choose another name.
> var __ = require("underscore"); > __.uniq([5, 3, 5, 5, 3, 1]) [ 5, 3, 1 ]
Opinions expressed by DZone contributors are their own.