Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
askmrsinh
· 1y ago · 0 comments
Why not do:
const y = x ? true : false;
Comments
[–]
stevage
1y ago
I'm talking about cases with additional logic that's too long for a ternary.
[–]
1718627440
1y ago
That sounds like a more complicated way to write
const y = (bool)x;
or
const bool y = x;