Over a million developers have joined DZone.

Trying out Underscore on Node.js

· Web Dev Zone

Start coding today to experience the powerful engine that drives data application’s development, brought to you in partnership with Qlik.

Underscore is a library that nicely rounds out JavaScript’s rather limited standard library. Thanks to the Node Package Manager, it’s very simple to install on Node.js:
    $ npm install underscore
Then 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
    > _
    7
Solution: choose another name.
    > var __ = require("underscore");
    > __.uniq([5, 3, 5, 5, 3, 1])
    [ 5, 3, 1 ]

 

From http://www.2ality.com/2012/01/underscore-on-nodejs.html

Create data driven applications in Qlik’s free and easy to use coding environment, brought to you in partnership with Qlik.

Topics:

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}