How to check if a set contains an object in TypeScript

1 Answer

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

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

 



answered May 14, 2022 by avibootz
...