How to check if a key exists in a map with Node.js

1 Answer

0 votes
const mp = new Map([
  ['javascript', 1],
  ['nodejs', 2],
  ['typescript', 3],
  ['c++', 4],
]);

console.log(mp.has('nodejs')); 

console.log(mp.has('python')); 
  
  
  
  
/*
run:
  
true
false
  
*/

 



answered Jun 23, 2022 by avibootz

Related questions

1 answer 167 views
2 answers 158 views
1 answer 183 views
1 answer 207 views
1 answer 155 views
1 answer 121 views
1 answer 135 views
...