Showing posts with label React. Show all posts
Showing posts with label React. Show all posts

Monday, 21 July 2025

TypeError: crypto.hash is not a function React and Node JS

 I got this error while executing the code , To resolve this error done the following steps:


1. Removed the node modules folder completely in project folder 

2. Then in project terminal executed the following steps:

    i. npm install

    ii. npm install node

    iii. npm install n -g 

3. Run the project using the following command

    npm run dev

Wednesday, 6 October 2021

Arrays filtering in MERN Mongo , express, react and node

let array1=[1,2,3];
let array2=[1,2,4,5,6,7,7,4,3,2,1,4,5,5,2,3,3,1,2,9,8,6,4,3,2,7,1] 

remove array1 element from array2,expected out=[4,5,6,7,7,4,4,5,5,9,8,6,4,7]

 

Solution : 

let array1=[1,2,3];
let array2=[1,2,4,5,6,7,7,4,3,2,1,4,5,5,2,3,3,1,2,9,8,6,4,3,2,7,1];


let output = array2.filter((item)=> !array1.includes(item))

console.log(output);