⬆️ ⬇️

Oh this javascript

Do you consider yourself a guru of JS? Try to predict the results of the following operations:



Number.MIN_VALUE > 0; // true or false?



typeof null ; // what type?

null === Object; // true or false?



//



NaN === NaN; // true or false?



typeof NaN; // what type?





* This source code was highlighted with Source Code Highlighter .




Doubt? Then it is for you that Brian Leroux created WTFJS , a site containing a collection of weird JS. "JavaScript is a language that we love despite all its hated features."

')

For impatient answers under the cut.







Number.MIN_VALUE > 0; // true

/*

, MIN_VALUE ,

*/



typeof null ; // object

null === Object; // false

/*

null, "object", Object'

*/



NaN === NaN; // false

/*

, ? . , ...

*/



typeof NaN; // number

/*

. , NaN — not a number.

*/



* This source code was highlighted with Source Code Highlighter .




Hopefully, it will amuse someone, but someone (well, suddenly) will help.

Source: https://habr.com/ru/post/84311/



All Articles