RSS Feed Subscribe to RSS Feed


Code Camp: JavaScript


Speaker: Douglas Crockford

Doug described JavaScript as ‘the World’s most misunderstood language’.

A language of many contrasts, with good and bad aspects.


  • Slow and not well understood.
  • Global variables (causes bugs, security issues)
  • + can be used for both add and concatenate (can cause bugs)
  • Semicolon insertion (automatically done, erroneously sometimes)
  • too many null type vaues (e.g. null, undefined, NaN), many of which fail transitivity rules (to avoid, always use ===, not ==)
  • Floating Arithmetic operations can be troublesome


  • JavaScript is succeeding very well in an environment where Java was a total failure (i.e. on client side)
  • It is the most widely deployed functional programming
  • Lambda (using a function as an argument in a call to another function)
  • Dynamic Objects (create an Object and programically add stuff to it!)
  • Loose typing (Strong typing means you have to specify the type of every object and param etc, so compiler can verify all is OK; Allows for detection of errors early). In JavaScript vars and params don’t have types. Doesn’t eliminate bugs! Most bugs are not typing bugs. ‘Typing’ type bigs tend to be easy to find anyway. Benefit of loose typing is no casting; more elegant code;

Other points:

  • Inheritance – JavaScript uses Prototypal Inheritance (almost all other languages, incl Java, use Classical Inheritance
  • Closure
  • An inner function has access to all the cars of an outer function, even after the outer function has returned. This is supposed to be the best part about JavaScript?
  • JSLint – A JavaScript verifier/standard worth taking notice of. The only JavaScript library that currently adheres to JSLint is Yahoo’s User Interface (YUI).

Clearly JavaScript has many good parts (including many I would like to read up more on such as Closures, Module pattern), but its bad points seem very bad, cause lots of bugs, takes a lot of effort to avoid.


Leave a Reply