to find a number of unique letters in string
<html>
<head>
<script type="Text/javascript">
function code(n, digits, padChar) {
n = n.toString();
while (n.length < digits) {
n = padChar n;
}
return n;
}
var str = window.prompt("Enter String");
var array = [];
var totalCount;
var count=0;
for(var i = 0; i < str.length; i ){
if(!array[str[i]]) {
array[str[i]] = 1;
} else {
array[str[i]] = 1;
}
}
sortedArray = [];
for(var i in array){
sortedArray.push(code(i.charCodeAt(0), 5, '0'));
}
sortedArray.sort();
for(i = 0; i < sortedArray.length; i ){
count ;
}
document.write("Number of unique letters are: " count);
</script>
</head>
</html>
please know what is wrong with this code?