|
|
|
|
|
by yuchi
4867 days ago
|
|
I'm ashamed that a lot of rants about languages get so many points here on HN. This article, in particular, is written by a JavaScript ignorant, which for the first time approaches the language. Even worse, "JavaScript the good parts" is a good read, but it shouldn't be promoted as the _de facto_ bible of JavaScript as it is: it's old, outdated, lacks a lot of the recent changes and promotes a lot of patterns which became anti-patterns. An example of my last sentence: have look at how Titanium SDK (v2.1.x) folks designed their "parasitic inheritance" architecture following Crockford's book. A terrible, unusable, instable, un-hackable (wrong) use of JavaScript. EDIT: I don't know if Steve Kwan is actually a _noob_ or not, but it looks like. Eg: identifier = function () {};
this is not one of the examples of "ways to create a function". This is actually an assignement using a function expression. These are the 3 REAL ways: // As expression, in an assignement or as argument.
(function () { /*...*/ });
// As expression, but with a name given to it.
(function $identifier$ () { /*...*/ });
// As a declaration, which gets HOISTED!!
function $identifier$ () { /*...*/ }
|
|