Posts

Showing posts from November, 2020

Date Range Picker In Angular 10

Image
 Previously if you need to select a start date and end date in date picker, this is not possible in one date picker. so we create two different date-picker one for the start date and the other for end date Rage Date Picker required two dates Start Date and End date. If you want to select two Dates in the Date picker then angular 10 Release Range Date Picker where you can select start date as well as end date in the same date-picker. You can use the mat-date-range-input and mat-date-range-picker components. they work similarly to the mat-date picker and basic date Picker. The mat-date-range-input component requires two input elements for the Start Date and the end date. you need the below libs for the Range date picker : 1. Angular material  (ng add @angular/material) 2.moment (npm install moment -- save) 3.material-moment-adapter (npm install @angular/material-moment-adapter) Syntax : <mat-date-range-input>   <input matStartDate placeholder="Start Date"></i...

Const keyword in JavaScript

Before ES2015  javascript variable has only two scopes i.e.  Global Scope   and   Function Scope . but in ES2015 they introduced the cinst keyword. this keyword provides Block scope variables. Block scope means  Variables declared inside a block  {}  cannot be accessed from outside the block.once you declared the constant variable you cannot declared this vsriable again.once you assigned the value in const variable, you can not reassigned value again.

JavaScript Hoisting with Example

Image
 When you execute the javascript code at that time javaScript engine create the global execution context. global execution context means js code starts the execution when the file first load in the browser. the code is not inside any function or any object block that code is in a global execution context. this global execution has two-parts creation and \execution. during the creation part, All the javascript deceleration moved to the top of the code. i.e all javaScript engine by default move these global declared variables and function on the top of your code. this javascript behaviour called "Hosting". There are two types of hoisting possible in javaScript 1. Variable hoisting 2. Function hoisting  1. Variable Hoisting in the variable hoisting All the global variable decelerations are moved to the top of the code. For Example : console.log("My Fav fruit " + fruit); var fruit = "Mango"; In the above example, I have declared the fruit variable. when you ru...

let - Keyword in JavaScript (Block scope)

Image
Before ES2015  javascript variable has only two scopes i.e.  Global Scope   and   Function Scope . but in ES2015 they introduced the let keyword. this keyword provides Block scope variables. Block scope means  Variables declared inside a block  {}  cannot be accessed from outside the block. For Example : function getPersonDetails(){       var name ="Nilesh";       let newName = "Nil" } console.log("Print variable with var "+ name);    // you can access name variable outside function console.log("print variable value with let"+newName);  // you can not access newName Variable outside. In the above example getPersonDetails is a function that contains two variables "name " and "newName" with the keyword var and let. hear you can access the name variable which is declared with var keyword outside of the function. but you can not access the newName variables which is declared with the let keyword outside of the f...

For in loop - typescript full explanation

Image
 For..in the loop is used for iterating on array in typescript. For..in loop return the index of array elements.this loop can be used with Array,List,Tupel Syntax:  for(let index in <some array>){     //statements  } For Example : let person = ["SAM","BOM","BOB","NIL"] for(let index in person){ console.log("index"+index);   // this will print index console.log("name : " + person[index] );   // this will print array's value.  }