Print Shortlink

Improved productivity with Node.js

Writing raw JavaScript code and running it in a browser to test it has always been a non-agile technique. You have to unneccesarily create a HTML page, include the JavaScript code in it and run the HTML page in a browser to test if the code works fine. Tedious!!!
The browser invokes the JavaScript interpreter/runtime to execute the code. It will be useful if you can run your JS code directly using the JavaScript interpreter just like you would work with other programming languages.
Welcome Node.js. Node.js is a standalone JavaScript interpreter that is built using Google Chrome’s V8 JavaScript engine. It’s not only a JavaScript engine but also a comprehensive API for building powerful applications using JavaScript.
Let’s discuss the standalone interpreter feature that improves our productivity while working with JavaScript. You can download and install node.js from here. After installation you can type in the command “node” in the command prompt and pass in the js file that you want to execute.
Given below are the screen shots for creating a sample JS code and running it in an agile manner.
You can open the command prompt and create a JS file say Sample.js using notepad.

Let’s type in some JS code and run it using node command.

Writing JavaScript code without mixing HTML fragments, writing unit tests, executing them etc., is more light-weight now, thanks to Node.js.

Leave a Reply