Author Mike Rough
JavaScript is one of the most widely used languages today on the web by our engineers and others around the world. We wondered why it was so popular and what aspects of it that engineers loved and hated about it. In our quest for understanding we interviewed our Principle Engineer Mike Scolara about what he loves and hates about programming in JavaScript. Here was his top 10 JavaScript loves and hates:
10 things I love and hate about client side JavaScript
Love:
Closures & their tricky but awesome scoping rules
(Closures are a type of anonymous function that pull variables into scope from where they are defined. Using this scoping magic, nested closures can be used to perform ‘partial function application’. Closures are often used, quite elegantly, for callbacks and completion routines.)
jQuery
jQuery Plugins
jQuery Mobile
Chrome’s built-in debugger & developer tools & Firebug & Firebug Lite
functions are objects
Greasemonkey & Chrome extensions
JSON
AJAX libraries on CDNs (like Google)
arguments object
Hate:
Global scope is the default
(Forgetting to specify a variable as local (with var) causes it to be global. Also if you mistype or misspell a variable name the results can be catastrophic and often create hard to find bugs that sometime don’t show up until much later, i.e. create land mines for the next to work on or make use of the code.)
IE6
typeof doesn’t do what you expect with Arrays and null
Lack of Date objects in JSON & object literals
ActiveX
Cross browser incompatibilities
No block scope
0.1 + 0.2 !== 0.3
+ operator is used for both addition and concatenation
Weird cross-site scripting restrictions
We would love to hear what your favorite features or challenges are about this widely utilized language!