How to check if a set contains an object in Node.js

1 Answer

0 votes
const obj = {
  lang1: 'nodejs',
  lang2: 'c',
  lang3: 'python',
};
 
const st = new Set([obj, {lang4: 'php'}]);

console.log(st.has(obj)); 
 
    
    
    
    
/*
run:
    
true
    
*/

 



answered May 14, 2022 by avibootz

Related questions

1 answer 212 views
1 answer 207 views
1 answer 223 views
1 answer 198 views
1 answer 217 views
...