Follow

@CppGuy @bleepbloop @anon_opin That's a fair point, integer types are a bit of an exception. In much the same vein, performing equality on floating points should always be invalid. Numbers are just different, I suppose

@rlamacraft @CppGuy @anon_opin truthy and false comparisons are handy with implicit coercion too.

if (input !== null && input !== undefined && input !== 0 && input !== "" && input !== false && !isNaN(input)) {
// Do something if input is truthy
}

i prefer this:

if(input) {
// do something if input is truthy
}

of course we’re all very disciplined and are only going to have one possible type for input right? 😉

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.