Sunday, March 23, 2008
What makes JavaScript so different from other languages? Is it its
dynamic nature? Its prototype-based funky inheritance? No. The most
unusual thing for newcomers is how JavaScript programs handle the
workflow. The program looks like a bowl of spaghetti. There is no start
or end of the program. What we have here is a bunch of functions, which
are called in response to some external events. In most cases we have
no way to predict the order of these events. And we know that all
callbacks are called from a single thread. Of course we know that it is
not a nature of JavaScript but rather a limitation imposed by a
specific container of JavaScript programs — web browsers. Majority of
JavaScript code is written for browsers and now we have a perception
problem. But let's dig deeper to understand the problem better.
[Read more]