Some times your interviewer ask you that count the every character in the string
const str = "how are you";
const objt = {}
for(let x of str){
if(obj[x]){
obj[x] += 1;
} else{
obj[x]=1
}
}
console.log(obj)
Result:
{
//
}