How to determine if a string has all unique characters in Node.js

1 Answer

0 votes
const str = 'node.js c';
 
const result = new Set(str).size == str.length;
 
console.log(result ? "yes" : "no"); 
   
   
   
   
   
/*
run:
   
yes
   
*/

 



answered May 7, 2022 by avibootz

Related questions

1 answer 133 views
1 answer 154 views
1 answer 125 views
1 answer 127 views
1 answer 110 views
...