Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/MultithreadedJSBook/code-samples
/ isHappy
Function
isHappy
ch3-happycoin/happycoin-piscina.js:20–25 ·
view source on GitHub ↗
(num)
Source
from the content-addressed store, hash-verified
18
}
19
20
function
isHappy(num) {
21
while
(num != 1n && num != 4n) {
22
num = sumDigitsSquared(num);
23
}
24
return
num === 1n;
25
}
26
27
function
isHappycoin(num) {
28
return
isHappy(num) && num % 10000n === 0n;
Callers
1
isHappycoin
Function · 0.70
Calls
1
sumDigitsSquared
Function · 0.70
Tested by
no test coverage detected