Difference in local storage and session storage?
localStorage and sessionStorage are both web storage options provided by modern web browsers to store data on the client side (in the user’s browser) without relying on cookies. They are…
Empowering the Coding Wave
localStorage and sessionStorage are both web storage options provided by modern web browsers to store data on the client side (in the user’s browser) without relying on cookies. They are…
In React.js, a “pure component” refers to a specific type of component that aims to optimize rendering performance by automatically implementing the shouldComponentUpdate method. This method determines whether a component…
call, apply, and bind are three methods available in JavaScript that are used to manipulate the this value and call functions in different ways. They are often used to control…
var a= ‘amit’;var b=a; function abc(){console.log(‘in a1 :’,a)var a = ‘Mohit’;console.log(‘in a2 :’,a)}b =’sumit’abc(a);console.log(‘a’,a)console.log(‘b’,b) Output: It looks like you’ve provided a JavaScript code snippet. Let’s break down what’s happening step…
//check a string has substring or notconst str = ‘Har har Modi,Ghar-Ghar Modi.’;const sub_str = ‘Modi’;console.log(‘Is string has a substring? ‘,str.includes(sub_str))// this is case senstive //Get first index of a…
//Get Sum of Fruites from Array Element const fruites = [{‘apple’:4,’mango’:7,’banana’:10},{‘apple’:7,’mango’:2,’banana’:11},{‘apple’:1,’mango’:6,’banana’:14},];let cnt = [];fruites.forEach((v)=>{for(key in v){cnt[key]= (cnt[key]+v[key]) || v[key];}})console.log(‘v’,cnt)
In JavaScript, map, filter, and reduce are array functions used to perform transformations on arrays. Each of these functions serves a different purpose: Syntax: Example: Syntax: Example: Syntax: Example: In…