This chapter gives you a quick introduction to new features that affect your coding. Many other languages, including JavaScript, have this feature—the ability to declare a variable using a var keyword (in Java, it is actually a reserved type name, not a keyword). It has many advantages but is not without controversy. If used excessively, especially with short non-descriptive identifiers, it can make the code less readable and the added value may be drowned out by the increased code obscurity.
That is why in the following recipe, we explain the reasons the reserved var type was introduced. Try to avoid using var in the other cases.