Learnitweb

Author: Editorial Team

  • typeof operator in JavaScript

    1. Introduction The typeof operator returns the type of the object or primitive operand. The return type of typeof is string. The typeof operator is very helpful but is not suitable for all situations. The typeof operator returns object for many objects so it can not be used precisely in the code to check the…

  • Arrow function expressions in JavaScript

    1. Introduction An arrow function expression is a short and compact form of writing traditional function expression with some limitations. It is not a complete replacement of traditional function expression and is not suited for all situations. Let us understand this with an example. Following is the traditional anonymous function: The equivalent arrow function is:…

  • JavaScript apply() method

    1. Introduction The apply() method calls a function. While calling this method you can provide this argument and arguments as an array. The apply() method is identical to that of call() with difference that arguments are passed to call() as separate arguments whereas arguments are passed to apply() as an array. Following are valid versions…

  • JavaScript call() method

    1. Introduction The call() method calls a function. While calling this method you can provide this argument and other arguments. All the following are valid versions of call() method: thisArgument is the optional argument which is used as this. arg1….argN are the optional arguments provided to the function. 2. Examples of call() Example 1: Using…

  • Custom pipe in Angular

    1. Introduction Pipes are used for transformation of values. Angular provides several built-in pipes but sometimes the built-in pipes are not able to fulfill our specific requirement. Angular allows you to create your own custom pipe. Pipe is a class decorated with @Pipe decorator and a function to transform the value. This decorator @Pipe marks…

  • Angular pipes – an introduction

    1. Introduction The main purpose of pipes is transformation. Pipes are used for transformation of strings, dates, currency amounts and other data. Pipe’s main purpose is only for display purpose. Pipes are used as reusable functionality which are declared only once and reused in the application. Original value ——> Pipe ——> Transformed value You can…

  • Lazy-loading feature modules in Angular

    1. Introduction By default, Angular modules are eagerly loaded. This means that all NgModules are loaded as soon as the application loads. All NgModules are loaded whether they are required or not. This increases the load time of the page. This is not a good design. Suppose there are certain modules in your application which…

  • Introduction to Angular modules and NgModule

    1. Introduction In this tutorial, we’ll discuss modules and NgModules in Angular. Angular applications are modular. If you create a simple Angular application using Angular CLI, you’ll observe that it has AppModule. Angular modules enables several important features like ahead of time compilation and lazy loading. A module in Angular is a container for a…

  • Inheritance and the prototype chain in JavaScript

    1. Introduction In this tutorial, we’ll discuss inheritance and the prototype chain in JavaScript. Prototype chain is one of the most confusing topic of JavaScript and is the most important concept to know in JavaScript as many cool features of JavaScript are based on prototypal inheritance. In nature, you’ll see inheritance everywhere. Every man inherits…

  • Nullish coalescing operator ‘??’

    1. Introduction In this tutorial, we’ll discuss nullish coalescing operator. Nullish coalescing operator is written as double question marks (??). The syntax of nullish coalescing operator is: Nullish coalescing operator works in the following manner: return leftExpression if not null or undefined. return rightExpression if null or undefined. nullish coalescing operator is short and convenient…