Author: admin

  • ES6 Modules

    Introduction to ES6 modules In the early days, JavaScript initially served small scripting tasks that provided interactivity to web pages. Nowadays, JavaScript has evolved to power complete applications in browsers and servers (Node.js). To handle this growth, it is necessary to modularize JavaScript code into modules and make them reusable across applications. ES6 introduced the…

  • JavaScript Call Stack

    A call stack is a way for the JavaScript engine to keep track of its place in code that calls multiple functions. It has the information on what function is currently being run and what functions are invoked from within that function… Also, the JavaScript engine uses a call stack to manage execution contexts: The call stack works…

  • Execution Context

    Let’s start with the following example: let x = 10; function timesTen(a){ return a * 10; } let y = timesTen(x); console.log(y); // 100 Code language: JavaScript (javascript) In this example: Behind the scenes, JavaScript does many things. in this tutorial, you will focus on execution contexts. When the JavaScript engine executes the JavaScript code,…

  • What is reflection

    In computer programming, reflection is the ability of a program to manipulate variables, properties, and methods of objects at runtime. Prior to ES6, JavaScript already had reflection features even though they were not officially called that by the community or the specification. For example, methods like Object.keys(), Object.getOwnPropertyDescriptor(), and Array.isArray() are the classic reflection features. ES6 introduces a new global object called Reflect that…

  • JavaScript Proxy

    A JavaScript Proxy is an object that wraps another object (target) and intercepts the fundamental operations of the target object. The fundamental operations can be the property lookup, assignment, enumeration, function invocations, etc. Creating a proxy object To create a new proxy object, you use the following syntax: let proxy = new Proxy(target, handler); Code language: JavaScript…

  • Differences Between var and let

    #1: Variable scopes The var variables belong to the global scope when you define them outside a function. For example: var counter;Code language: JavaScript (javascript) In this example, the counter is a global variable. It means that the counter variable is accessible by any function. When you declare a variable inside a function using the var keyword, the scope of the variable is…

  • Declaring Constants in ES6

    ES6 provides a new way of declaring a constant by using the const keyword. The const keyword creates a read-only reference to a value. const CONSTANT_NAME = value;Code language: JavaScript (javascript) By convention, the constant identifiers are in uppercase. Like the let keyword, the const keyword declares blocked-scope variables. However, the block-scoped variables declared by the const keyword can’t be reassigned. The variables declared…

  • Introduction to the JavaScript let keyword

    In ES5, when you declare a variable using the var keyword, the scope of the variable is either global or local. If you declare a variable outside of a function, the scope of the variable is global. When you declare a variable inside a function, the scope of the variable is local. ES6 provides a new way of declaring…

  • Classes

    TypeScript is object oriented JavaScript. TypeScript supports object-oriented programming features like classes, interfaces, etc. A class in terms of OOP is a blueprint for creating objects. A class encapsulates data for the object. Typescript gives built in support for this concept called class. JavaScript ES5 or earlier didn’t support classes. Typescript gets this feature from…

  • Interfaces

    An interface is a syntactical contract that an entity should conform to. In other words, an interface defines the syntax that any entity must adhere to. Interfaces define properties, methods, and events, which are the members of the interface. Interfaces contain only the declaration of the members. It is the responsibility of the deriving class…