by akhada.digital | Aug 11, 2023 | Uncategorized
Problem Description: Find the number of pairs in a given array arr that add up to produce a given number k. Basic Approach: function findPairs(arr, k) { let numOfPairs = 0; // 'numerOfPairs' will return double the actual number of pairs because of nested...
by akhada.digital | Aug 8, 2023 | 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...
by akhada.digital | Jul 29, 2023 | Uncategorized
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);...
by akhada.digital | Jul 23, 2023 | React JS
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...
by akhada.digital | Jun 5, 2023 | React JS