Jasmine is a framework which is used for testing node.js code or javascript code. Installation To install the latest official version, use NPM: [js]npm install jasmine-node -g[/js] Write the specifications for your code in *.js and *.coffee files in the spec/ directory Execution After installing the npm package, you can...
Like other languages(Java, php), we do not need to set up any Apache HTTP server. With Node, things are a bit different, with Node.js, we not only implement our application, we also implement the whole HTTP server. In fact, our web application and its web server are basically the same. Lets create a basic Node HTTP server. First let's...
Node.js is single threaded so it runs one process on a single CPU, as the power of Node.js is its performance and speed it doesn't seem good to use only one CPU in a multi-core system. For utilizing all the CPUs, Node.js allows us to create a network of processes that all shares the same port. Create a file named clusterExample.js ...
We are assuming that you have installed js2 in your system, in case if you have not installed js2, first install js2. First of all create a InheritanceTest.js2 file in scr directory with the content given below: [js] class Person { // Parent class var firstName; var lastName; function initialize(firstName, lastName)...
We are assuming that you have installed node.js in your system, in case if you have not installed node.js, first install node.js. To install js2 run the command given below: [bash] npm install js2 [/bash] Let’s create a simple Hello World project, but first let’s create a project directory structure: [bash] mkdir...
In my previous post, I explained how to get started with node.js and executing your first script with node. Now in this tutorial, we will go a step ahead and learn using Expressjs and MongoDB. For people who are new, Express is a web application framework for node which provides a set of features that can be used to build single-page as...
In this tutorial i will walk you through the installation of node.js on your Linux system and executing your first script with node. To get started goto the official node.js website and download the Linux Binaries file (as shown in the screenshot below) according the bit version of your system. Save the downloaded file in a specific...
Arrays in JavaScript are daunting and particularly difficult in nature. The fundamental reason for making this statement is that JavaScript does not provide as many functions/methods for array operations as several other languages do. As a result, an array operation as simple as removing duplicate elements from an array may also be...
Many people get confused with these two functions in JavaScript, most of the time people think that we can pass an object in apply() and access it with this which is not possible with the call() method. But that is not the case, let's see an example which will make it more clear. Using call() method: [js] (function sum(a,b,c) { ...