Skip to content
bebraw edited this page Jan 27, 2013 · 21 revisions

Here's an initial table of contents. I'll convert these into concrete pages as I go on. The Reddit thread contains some of the topics I should go through too so expect updates below.

In the meantime I recommend checking out JavaScript Garden and beginner's resources I've listed over at jswiki, the predecessor of jster.

The book has been aimed for beginners and intermediate level programmers. If you feel that the content could be improved, do submit issues. I'll take those seriously.

JavaScript - a Misunderstood Language?

As you might know the first version of JavaScript was developed in mere two weeks at 1995 by a fellow named Brendan Eich over at Netscape Corporation. Initially the language was known as LiveScript but the marketing men decided JavaScript sounds more believable. After all it was the decade of Java. On retrospect it wasn't a good choice and a lot of confusion has ensued. Java is to JavaScript as ham is to hamster. Keep that in mind!

So how would you characterize JavaScript? Even though it looks a bit like Java or C due to bracing there it is actually an implementation of a couple of powerful languages in disguise. These languages are Scheme, a variant of LISP, and Prototype. From former JavaScript inherited some of its functional programming capabilities whereas latter gave it prototypal inheritance system which in some ways can be considered superior to classical one used by languages such as Java.

Particularly JavaScript's functional capabilities make it in some ways an exceptional language. Prototypal inheritance has caused a lot of confusion but it is possible to get around that. In fact it is possible to implement a classical system using it.

Of course JavaScript comes with the usual imperative programming constructs (for, while, if, etc.) you might expect. There is also some legacy in form of Date and Math modules inherited from Java 1.0. There are some custom features even (with comes to mind) though it is better to avoid some of those.

In fact you can get a lot done by selecting a subset of the language and then using that to its full extent. As JavaScript can feel a bit unwieldy sometimes people have implemented languages that compile to JavaScript. These languages provide some constructs not found in the language and can for instance provide stricter typing.

altJS lists these languages. Have a look at a few of those. Keep in mind, however, that in order to get most out of the languages you are better off learning JavaScript well. It will definitely help when you are trying to decipher the code they generate.

TOC

  • Special Features
    • Hoisting (scope!)
    • Closures (and how to get most out of those)
    • Prototypes (vs. classes as in Java etc.)
    • ???
  • Common Problems
    • var -> highlight globals!
    • function -> define shortcut, use another language? (CS and such)
    • pyramid of doom -> promises, futures, Rx?
    • equality -> it's a mess, use jshint or jslint to remind you
    • hard to find libraries -> use JSter and such
  • Modules
    • AMD
    • CommonJS (Node!)
    • Harmony
    • Transpilers (AMD -> Node, vice versa + Harmony, not 1-1 always)
  • Package Managers
    • Frontend - too many, maybe mention bower (component.json)
    • Backend - Node NPM, use it
  • Build Systems
    • Benefits (minification, improved dev env (LiveReload, precompilers)
    • grunt, jake? others?
  • Boilerplates
    • yeoman
    • ???
  • Full Stack Development
Clone this wiki locally