Happy Number | method return true if n is Happy Number numSquareSum method is given in below detailed code snippet
let st = new Set ( ) ; while ( 1 ) { n = numSquareSum ( n ) ; if ( n == 1 ) return true ; if ( st . has ( n ) ) return false ; st . add ( n ) ; } }