What is Node.js

node.js
Node.js is a server-side platform built on V8 javascript Engine. V8 Engine is Google Chrome’s open source Javascript engine. It is an open source, the cross-platform runtime environment for developing server-side scripting applications and networking tools. It is mainly used to develop web applications.It can be used on the server side as well as on the client side. Continue reading “What is Node.js”

Node js sortBy() based on multiple attributes using Underscore

How to sort an array with objects based on multiple attributes

The first property “primaryScore” is same between the two objects. The two “primaryScore” is equal to 75. So the second property I am going to use to compare the three objects is “secondaryScore”. consider the following array:
var persons = [
{name: 'John', primaryScore: 75, secondaryScore: 60},
{name: 'Sansa', primaryScore: 75, secondaryScore: 50},
{name: 'Arya', primaryScore: 80, secondaryScore: 60},
{name: 'Sam', primaryScore: 80, secondaryScore: 50}
];

Continue reading “Node js sortBy() based on multiple attributes using Underscore”