var isHappy = function(n) {

```
var sum=0;
var m;
var hashTable ={};
while(n){
while(n!= 0){
m=n%10;
n=parseInt(n/10);
sum=sum+m*m;
}
if (sum == 1){
return true;
}
if(!hashTable[sum]){
hashTable[sum]=1;
} else{
return false;
}
n=sum;
sum=0;
}
```

};