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-5dcf4abb4ad9f09295229...

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-5dcf4abb...

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-5dcf4abb647f0202765078/] 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-5dcf4abb683d5981881065/] Just for a reference check what the map function gives in return [crayon-5dcf4abb683df428646658/]   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-5dcf4abb68d25612012891/] Now,from the above we realize that arrays and objects in javascript are mutable,ie they can be mutated. Functions like slice retu...



Understanding Map object in JavaScript

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-5dcf4abb4ad...

Q: Handling errors while using Async/Await (JavaScript ES8)

This article aims at providing an insight into handling errors while using async-await. In the below example, a  function TestPromise will return a promise.The promise will give an error and get rejected if the value of the variable budget is less than 20000. The promise will always get rejected as we initialize the value of  budget to be 10000. A function calltestAPromise calls the function TestPromise.   [crayon-5dcf4abb...

Beginners guide to installing and setting up MongoDB and GUI for MongoDB in Windows Machine
databases , MongoDB , Uncategorized / September 26, 2019

This is a step by step tutorial for installing MongoDB and setting up a GUI for MongoDB on Windows OS   Step – 1 Check whether MongoDB is already installed in the system To check whether MongoDB is already installed in the system, and the PATH variable is configured, use the following command. This will output the version of MongoDB . [crayon-5dcf4abb4bbc2581147607/] The following command will output the Mongo shell version [...

Node.js – tools/packages/practices for building a secure,high performance API with quality code

Contents >Code standard and styling >Security >Performance         In this article, we will take a look at some important aspects to be considered while developing Node.js applications and the tools/packages/practices that can be used to achieve them. Understanding and using these will help you in building a secure web application that is well structured and well documented and has a very high performance. C...

Guidelines for building a secure Web application/Mobile application – Part 1 Front-end

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 w...

Check for duplicates in JavaScript Array of Objects
Express.js , Javascript , Uncategorized / July 28, 2019

How to check whether an Array of Objects contain duplicates by key Consider an Array of student Objects with each object having a key id. We have to perform a validation whether multiple objects with the same Id is present in the Array or not. [crayon-5dcf4abb4d3ed972836287/] The above are Arrays of student Objects, one with duplicate id value and one without duplicate id value. To get the  Ids present in the Arrays we need to use the ...

Web Storage – A comparative study of Local Storage,Session Storage,Cookies,IndexedDB and WebSQL
databases , Javascript , Uncategorized / July 10, 2019

Storages in browsers – Web Storage Web Storage is the storage mechanism that allows Web applications to store data in Web Browsers. The various storage types include Local Storage, Session Storage, Cookies, IndexedDB, Web SQL. These storages are supported by most of the modern-day web browsers and are standardized by the World Wide Web Consortium. Web Storage lets a web application to store data which in turn helps in the effectiv...

Set and Get Custom Response Header values using Angular 5 and Express.js – Node.JS

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 [crayo...

Write Cloud Functions on Cloud Firestore and deploy – Introduction
databases , firestore , Node.js / May 16, 2019

Contents > What is Cloud Firestore >What are Cloud functions >Writing and Deploying Cloud Functions to write data to Cloud Firestore Collection What is Cloud Firestore It’s a NoSQL document database that lets you store data for your Mobile Application, web Application, APIs… It is Cloud-based, highly scalable and flexible. To see your Firestore database dashboard visit the below URL https://console.firebase.google.c...

Testing Node.js,Express.js API with Mocha and Chai – Typescript

Contents >What is Mocha >what is Chai >what is Chai HTTP >Installing dependencies and getting started >Writing tests in the test files What is Mocha Mocha is a Javascript testing framework working on both Node.js and in the browser. We can use mocha to test APIs written to run in Node.js, created using frameworks like Express. Mocha runs the test cases serially and provides very accurate reporting. Mocha makes testing as...