Functions in JavaScript

In JavaScript, there are several type of functions based on how they are defined and used. Function Declaration Defined using the function keyword, followed by the function name and block of code. Function declarations are hoisted to the top of their scope, allowing...

Array map(), filter() & reduce() Polyfill

Array.map() Polyfill const array = [1,2,3,4,5]; Array.prototype.myMap = function(callback) { let result = []; for (let i = 0; i < this.length; i++) { result.push(callback(this[i], i, this)); } return result; } let answer1 = array.map((element) => element * 2);...

React Lifecycle Methods

React lifecycle methods are special methods that allows us to hook into the various stages of a component’s lifecycle. These methods provide a way to execute code at specific points during the component’s existence. React lifecycle methods basically...