var str = "hello world";
var arr = str.split('');
console.log(arr)
var arr2 = [];
for (var j=0;j<=arr.length-1 ; j++){
for (var i=j+1,count=1;i<=arr.length-1 ;i++ )
{
if (arr[j] === arr[i])
{
arr.splice(i,1);
count++;
}
}
console.log(count);
}