JavaScript, the world's most popular programming language, has been labeled as a nightmare for Web development designers, and while the real nightmare is Domapi, the scripting language that has been exploited by a large number of developers and designers to augment their Web front end is now gaining weight, though, JavaScript still has a lot of confusing things to do.
1. It is named after Java, but not Java
It was originally called Mocha, then renamed to LiveScript, and finally decided to name JavaScript, according to historical records, Java's name and the cooperation between Netscape and Sun, in Exchange, Netscape in their popular browser created a Java Runtime. It is worth mentioning that the name of the introduction of nearly a joke, you know, LiveScript and Java in the client script has a hostile relationship.
Anyway, one of the things that people later have to clarify is that JavaScript has nothing to do with Java.
2. Null is an object?
Look at this code and it returns object.
This is really confusing, how can it be an object if NULL represents a null value? To put it simply, it was the first version of JavaScript that was wrong, and it was even borrowed directly from Microsoft's JScript.
3. Nan!== nan
Nan, which represents a non-numeric value, however, the problem is that Nan is not equal to anything, not even to itself.
This is obviously not true, in fact, if you want to determine that a value is really NaN, you need to use the isNaN () function.
4. Global variables
The
Dependency on global variables has always been considered the worst part of JavaScript (ECMA JavaScript 5 has removed global variables, see ECMA to launch JavaScript 5-translator). For simple pages, this doesn't matter, but complex pages, if it contains a lot of JavaScript scripts, you can hardly know where a global variable is declared, and if several global variables are accidentally duplicate names, an error is raised.