Using Node.js to Run JavaScript

One of the things that I love about Node.js is how easy it is to run and test JavaScript code. This speeds up development by enabling you to easily test functions and snippets without a web browser or web server. There are two main methods to run JavaScript code using Node.js.

The first method to run JavaScript using Node.js is to simply type the JavaScript code directly in the Node.js shell. This is the method you used in the preceding section where you printed Hello on the screen. One thing to note is that when you execute commands in the Node.js shell, the result of those commands is also displayed along with the output. If the statement being executed does not return a result, then the word undefined is displayed. ...

Get Learning AngularJS now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.