Coding since 11yo, that makes it over 30 years now ~~~
Have a PhD in Comp Sci ~~~
Love to go on bike tours ~~~
I try to stay as generalist as I can in this crazy wide place coding is at now.
Fun fact: any combo of any number of [], 0, "", whitespace (mix-and-match is ok: " \n\n\n\r \t"), ".", "0" (repeated if you like: "000"), null, false added together will loose equal false, so long as:
you're careful never to stringify a false or null,
or put whitespace between two zeros or a dot and a zero
and if you have a dot, there is only one and there must also be at least one zero
other rules I haven't thought of
0+"0"+[]+"\n\t\r"==false// yep, it's "00 \n\t\r "false+0+[]+"00000"+[]+""==false// yep, it's "000000 "0000+null+[]+[]+0+'0'+""+[]==false,// totally, "000"0+false+null+""+[]+[]+'000'+0+'.'==false// uhhuh, "00000."but[]+[]+""+false!=false// the false was concatted as "false". "false" isn't falsey.
On a related note, static typing is great 😁 and there are plenty of tools/libs/langs available to code JS without this JS-framer weirdness.
Fun fact: any combo of any number of
[]
,0
,""
, whitespace (mix-and-match is ok:" \n\n\n\r \t"
),"."
,"0"
(repeated if you like:"000"
),null
,false
added together will loose equalfalse
, so long as:false
ornull
,On a related note, static typing is great 😁 and there are plenty of tools/libs/langs available to code JS without this JS-framer weirdness.
Awesome comment! Thanks for the additional info.
I think JS is like poker to some extent. It takes a minute to learn and a lifetime to master 😂