const text2 = 'You know nothing Jon Snow';
function countUniqChars(str){
let box = str[0];
let count = 0;
for(let i = 0; i < str.length; i += 1){
for(let j = 0; j < box.length; j += 1 ){
if(box[j] != str[i]){
box += str[i];
console.log(box);
count += 1;
}
}
}
return count;
}
console.log(countUniqChars(text2));
const countUniqueChars = str =>
new Set(str).size;
const countUniqueChars = str => [...str]
.reduce((acc, n) => (acc.includes(n) || acc.push(n), acc), [])
.length;
const countUniqueChars = str => Array
.from(str)
.reduce((acc, n, i, a) => acc + (i === a.indexOf(n)), 0);
const countUniqueChars = str => Object
.keys(Object.fromEntries([].map.call(str, n => [ n, 1 ])))
.length;
const countUniqueChars = str => str
.split('')
.sort()
.filter((n, i, a) => n !== a[i - 1])
.length;
const countUniqueChars = str =>
(str && str.match(/(.)(?!.*\1)/g)).length;
indexOf()
const text2 = 'You know nothing Jon Snow';
function countUniqChars(str) {
return new Set(str.split('')).size;
}
countUniqChars(text2) // 13