How to count the unique characters in a string with JavaScript

1 Answer

0 votes
const str = 'javascript typescript node.js c++';

const count = new Set(str).size;

console.log(count); 
  
  
  
  
  
/*
run:
  
17
  
*/

 



answered May 3, 2022 by avibootz

Related questions

1 answer 115 views
1 answer 107 views
2 answers 165 views
1 answer 139 views
1 answer 116 views
...