WTF, JavaScript ?: “NaN is not a NaN” and other curiosities

WTF, JavaScript ?: "NaN is not a NaN" and other curiosities

Why is the output of [] ==![] // true? Why does a certain combination of brackets, square brackets, exclamation marks and plus signs cause the output ‘fail’? What’s up with the baNaNa-Joke? This entertaining find is about these and other exciting, funny and strange cases.

JavaScript is one of the most popular programming languages ​​of all. The syntax is – compared to languages ​​like Java or C – relatively simple. The JavaScript ecosystem and the community are growing continuously. Frameworks and tools are plentiful and the demand for JavaScript developers is high.

Programming language with pitfalls

With all its advantages, the programming language also has its pitfalls. Some of them make your development job hell, others are quite simply quite funny – that’s how the creator of the WTF JavaScript repo, Denys Dovan, introduces the collection. He was inspired by Brian Leroux’s talk at dotJS 2012.

In the repository you will find a few introductory sentences and notes on notation as well as a table of contents with a large number of examples, which are also explained really well and in detail. Often, other sources are also linked to in-depth knowledge.

Friends of the command line can use WTF JavaScript npm install -g wtfjs install over wtfjs Open it and call it up in the pager of your choice via the terminal. Everyone else can just go to the repo on GitHub.

The motivation behind the list is as follows: Dovan wanted to use WTF JavaScript to create a collection of curious, unexpected and interesting functions of the programming language – and to explain what was behind it. Simply because it is fun to learn something new from time to time. The Team project is a great resource for beginners to dig deeper into the idiosyncrasies of the language and take a look under the hood. For experienced JS developers, it’s a great reference for JavaScript’s weird quirks. It is quite possible that this group can still learn something from it. No matter which of the two groups you belong to – read the repository, it’s worth it.

Maybe also interesting for you:

You might be interested in that too

Ready to see us in action:

More To Explore
Enable registration in settings - general
Have any project in mind?

Contact us: