Skip to main content


Yeah javascript that makes... eh.. sense?

+ true + true + '5' + 3 - 1 === 252

js: true

Floppy πŸ’Ύ reshared this.

Also this kind of breaks my head:

null == 0; // -> false
null > 0; // -> false
null >= 0; // -> true

so null is not 0, it's not bigger than 0, but it is bigger or equal to 0 :|
gave I tried this with the interactive NodeJS-REPL, with live-feedback of evaluation results as I type.

Althought you gave away the punchline, the build-up still made laugh.
JavaScript is so wild! πŸ˜€

Yes, actually knowing that weird expression evaluates to true drew me in to try it myself. (And it's... delicious πŸ‘Œ that it's even three equal signs and not just two.)
Haha, that one's awesome too, indeed!

I couldn't describe my most favourite JavaScript quirk from the top of my head.

But luckily I got bookmarks instead of a functioning wetware memory and somebody posted this a while ago somewhere on the Fediverse:

8 Javascript quiz that may confuse you
https://pitayan.com/posts/8-javascript-quiz-that-may-confuse-you
i had to open node and check this, because i couldn’t believe. :blobfoxtableflip: this is so wild

Content warning: Re: javascript, sex mention

a=a=>a+a;a(a('a'-42+'a'))+" Batman"

Content warning: Re: javascript, sex mention

Here's a nice video explaining how it all works: https://yewtu.be/watch?v=sRWE5tnaxlI
@Sotolf This is why I like strongly-typed languages. The above would be flat-out rejected by the compiler as a syntax error in Haskell (or any other sane language).

This website uses cookies. If you continue browsing this website, you agree to the usage of cookies.

⇧