How to check if a map is empty in Node.js

1 Answer

0 votes
const themap = new Map();

console.log(themap.size); 

console.log(themap.size === 0 ? "empty" : "not empty");





/*
run:
 
0
empty
  
*/
  

 



answered Jun 2, 2022 by avibootz
edited Jun 2, 2022 by avibootz

Related questions

1 answer 149 views
1 answer 96 views
2 answers 200 views
1 answer 144 views
1 answer 168 views
2 answers 156 views
...