Map Hold key-value pairs Remember the order of insertion. Can have objects or primitive values as key or value. Map is a JavaScript object which can hold key-value pairs  and remember the order of insertion. Maps inherit from  Map.prototype. Map.prototype.constructor returns the constructor function that created an instance’s prototype. A new Map is created using the map constructor in the following way. [crayon-5dee601168a2304476937...

Security is the biggest concern while building web applications. Most of the web applications handle a lot of sensitive data and it is necessary to provide adequate security to protect this data from perpetrators. This series of articles discuss various security issues, types of attacks and guidelines to be followed for building a  secure application. Front-end    The basic security features that should be implemented in every web applica...

While working with Node.js and Angular, sometimes you might need to set some custom values in Response Header from the server-side and get these values in your Angular application. These values can be some tokens, keys or anything. This article is about completing this requirement. Server-side using Express.js and Node.js To set a custom value in the response header, you have to write the following code in your Express.JS server [crayon-5dee6011...

1 What is typescript? It is a strict syntactical superset of JavaScript, and adds optionaltype-checking along with the latest ECMAScript features. 2 What is two way data binding in angular? Two-way Binding. Data binding in AngularJS is the synchronization between the model and the view. When data in the model changes, the view reflects the change, and when data in the view changes, the model is updated as well. Binding   3 Types of bindings ...

While creating AngularJS applications,we might need to send multiple  http requests to backend apis to fetch the data that need to be populated within our HTML.In most cases, these backend apis might be protected using token .Also we might need to add a loading image to indicate the user that the data is being fetched. HttpInterceptor helps us to a display the loader image before and hide the loader image after completing the request  and also...

Angular 1.6 SPA server side pagination of data with sort. To create a SPA which lists user data with pagination  and sorting we need the following CDN links – Angular JS 1.6.9 js CDN. – Angular JS UI bootstrap -Bootstrap components written in pure AngularJS . – Bootstrap CSS file. STEP 1 – Create file index.html and add the relevant CDN links using the following codes. [crayon-5dee60116b9fc449486778/] STEP 2 – CREA...

HttpInterceptor –  feature in Angular 4.3. We may need to intercept Http request while building apps with Angular. Sometimes we may you need to intercept Http request to add something to request header or to do something with the response. We can use Http Interceptor to do some action when sending  a request.This can be achieved using  the following interceptor class which implemenets Httpinterceptor.The interceptor adds an ‘acces...

Node.js is an open source server environment which lets us write server side code in javascript. Node.js is asynchronous,single threaded and non-blocking .Node.js has very high memory efficiency which makes it very popular in server side  developement for web/mobile app.In this article we take a look at how to start of web developement in Node.js with Mysql as database. To install Node.js in your linux run the following command in the terminal [...

Filter function in javascript filters an array based on a given criteria and returns new array.For example if we want to get all elements in an array divisible by 2 as a new array,we can use filter function [crayon-5dee601152415568540634/] Just for a reference check what the map function gives in return [crayon-5dee60115241b973044361/]   Now lets’s go back to filter function.Lets see how filter function works on array of objects. [cray...

  Javascript strings are immutable.But javascript objects and arrays are mutable.A mutable object is an object whose content can be modified after it is created. An immutable object is an object whose content cannot be modified after it is created. Consider an the following example [crayon-5dee601152c2e231578180/] Now,from the above we realize that arrays and objects in javascript are mutable,ie they can be mutated. Functions like slice retu...



“use strict” – Understanding Strict Mode in JavaScript
interview questions , Javascript / June 10, 2018

While using certain JavaScript libraries,you might have seen some thing like [crayon-5dee60114d983708826410/]   inside the code.Many of us doesn’t exactly know what this exactly mean.In this article we take a look at the JavaScript  strict mode(ECMAScript 5) which might become handy while  appearing in JavaScript Developer Interviews. Strict mode literal expression, ignored by earlier versions of JavaScript,  lets us creat...

ORM & Using Sequelize ORM with Express (Node.js)

Object-relational mapping (ORM, O/RM, and O/R mapping) in computer software is a programming technique for converting data between incompatible type systems in relational databases and object-oriented programming languages(WIKI).ORM converts data between type systems that cannot co-exist. Sequelize is a promise-based ORM (Object relation model) for Node.js. It supports the dialects PostgreSQL, MySQL, SQLite, MSSQL and features solid ...

Binary Tree,Max Heap, Priority Queue and implementation using Javascript
Javascript , programming concepts / June 9, 2018

Binary tree is a tree in which every node can have maximum of 2 children.In a binary tree data structure , every parent node can have at most two child nodes.Below is an example of a binary tree. The node with value 100 is the root node.The value 50 and 20 are leaves. A max-heap is a complete binary tree (every node has two children apart from leaves) in which the value in each  node is greater than or equal to the values in the childr...

Starting off Node.js web developement in ubuntu/Linux Mint 18 – (ExpressJS,Mysql)

Node.js is an open source server environment which lets us write server side code in javascript. Node.js is asynchronous,single threaded and non-blocking .Node.js has very high memory efficiency which makes it very popular in server side  developement for web/mobile app.In this article we take a look at how to start of web developement in Node.js with Mysql as database. To install Node.js in your linux run the following command in the ...

Filter functions in JavaScript with examples

Filter function in javascript filters an array based on a given criteria and returns new array.For example if we want to get all elements in an array divisible by 2 as a new array,we can use filter function [crayon-5dee601152415568540634/] Just for a reference check what the map function gives in return [crayon-5dee60115241b973044361/]   Now lets’s go back to filter function.Lets see how filter function works on array of obje...

Understanding concepts of immutables and mutables in javascript

  Javascript strings are immutable.But javascript objects and arrays are mutable.A mutable object is an object whose content can be modified after it is created. An immutable object is an object whose content cannot be modified after it is created. Consider an the following example [crayon-5dee601152c2e231578180/] Now,from the above we realize that arrays and objects in javascript are mutable,ie they can be mutated. Functions like ...

Spread syntax(…) in JavaScript(ES6) – Explained

Spread syntax helps to expand iterables (Arrays, Objects, Strings) in places where zero or more entities are expected. Consider an example with array. [crayon-5dee601153b0f621750081/] Here 3 arguments are expected and we store them into an array [crayon-5dee601153b16828185850/] Now we use spread syntax to provide arguments in the array [crayon-5dee601153b18782933700/] The expected result is 6     Now while working with spread ...

Change detection strategy in angular – simplified
Angular/AngularJS , Javascript / June 4, 2018

Angular is based on  component.It is having component within component architecture.Change detection look for changes in bindings from root to leaves from top to bottom. The library Zone.js lets Angular find out when to update the DOM. Angular performs change detection on component and child components when some changes occur in your App.But as the number of components increases change detection becomes heavy.In order to tackle this...

Implementing priority queue in PHP
PHP , programming concepts / June 2, 2018

Queue is a First In First Out(FIFO) Data Structure.In a priority queue, an element with high priority is served before an element with low priority.The Standard PHP Library has the SplPriorityQueue class which can be used to implement priority queue.The insert(‘item’,priority) method is used to insert item and the corresponding priority in to the queue.See the below example to see mail sending to different mail id’...