Book Image

Learning Underscore.js

By : Alexandru Vasile Pop
Book Image

Learning Underscore.js

By: Alexandru Vasile Pop

Overview of this book

Table of Contents (14 chapters)
Learning Underscore.js
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using Underscore on the server with Node.js


In Chapter 1, Getting Started with Underscore.js, we briefly introduced Node.js together with instructions on how to install and use its package manager npm. By using Node.js from the operating system command line, we can execute JavaScript server-side code: JavaScript runs inside the Node.js process with full access to operating system resources.

Executing JavaScript with Node.js

At this point, Node.js and npm are available in the command line, and if we execute the command node, you should see a prompt > appearing in the console waiting for further input. We have launched Node.js as an interactive shell, which is similar to the browser JavaScript console mode, and we can now execute any JavaScript code and immediately see the feedback in the console. We can create a new object, read one of its properties, and then add a new property and read the new property all in the same interactive shell session (I used the Mac OS X terminal for this example...