Yep, thanks Angus
Regarding FEs - FDs, personally for casual helper procedures I use FDs I
usually use FDs. E.g.:
// library
(function (global) {
function format(data) {
/* code */
}
function isCorrect(x) {
/* implementation */
}
var thirdHelper = (isCorrect(10)
? function () { ... }
: function () { ... }
);
// etc
})(this);
I.e. in my own code in which I'm sure and if I manually place all the
data before their usage, I can normally use FDs (that's repeat the main
ideological and semantic reason -- they are just casual subroutines). In
contrast when I need exactly _literally_ created at _runtime_ by the
condition function, FE is the case -- this is already their ideological
and semantic rationale.
It's of course not my "the one and only" rule -- I can easily use always
FEs (for example -- for the syntactic consistency or really avoiding
unnecessary hoisting as in the example with concatenation of two files).
Dmitry.
On 09.02.2011 9:44, Angus Croll wrote:
Very nice article Dmitry. I share your philosophy of " more important
to understand the mechanics than judge it good or bad"
Side note about FEs. I normally prefer over FDs, partly because they
make top down reading more intuitive but mainly, I think, because they
illustrate that in JavaScript functions are first class objects
Thanks Dmitry
Angus
On Feb 7, 8:14 am, "Dmitry A. Soshnikov"<[email protected]>
wrote:
Hi colleagues,
Here's the summary of the recent discussion on Twitter about the
"hoisting" and its reasons.
"Note 4. Two words about "hoisting".
http://dmitrysoshnikov.com/notes/note-4-two-words-about-hoisting/
Dmitry.
--
To view archived discussions from the original JSMentors Mailman list:
http://www.mail-archive.com/[email protected]/
To search via a non-Google archive, visit here:
http://www.mail-archive.com/[email protected]/
To unsubscribe from this group, send email to
[email protected]