
Write a JavaScript code to find a number of unique letters in string. (Eg. if keyword is Tajmahal, Tajmahal count will be '5' , it only takes these letters T,j,m,h,l , not taken the letter a because it is repeated) , means it doesn't count the repeated letters.

Hello Friend,
Try the following code:
<script>
var st = window.prompt("Enter string: ");
var arr=st.split("");
var resulted = new Array();
for (var j=0; j<arr.length; j++) {
var key = arr[j].toString();
if (!resulted[key]) {
resulted[key] = 1
} else {
resulted[key] = resulted[key] + 1;
}
}
var str = "";
for (var j in results) {
if(resulted[j]==1){
str += j;
}
}
alert(str.length);
</script>
Thanks
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.