Topic: JavaScript

5 Quirks of JavaScript that You Should Know

The quirks of JavaScript listed here are ones that I techniques that I employ with frequency, possibly with the exception of the last one. Some people criticize JavaScript because of its misunderstood semantics, but once you put these quirks to use, you will see what a powerful language JavaScript can be. Infinity and its counterpart -Infinity are numbers in JavaScript. Try it out: >> 1/0 Infinity >> typeof(1/0) “Number” The easiest way to convert a string into a base-10 integer isn’t with parseInt(). It’s actually: >> +”234″ 234 The three-part tenary operator is very useful for quick one-liners when more if-blocks is the last thing you need: if (store.isOpen){     return… go on →