@@ -15,7 +15,7 @@ bridging the communication gap between us, squishy biological
1515organisms with a talent for social and spatial reasoning, and the
1616computer, unfeeling manipulator of meaningless data. The first is to
1717appeal to our sense of the physical world, and build interfaces that
18- mimic that world, and allow us to manipulate shapes on a screen with
18+ mimic that world and allow us to manipulate shapes on a screen with
1919our fingers. This works very well for casual machine interaction.
2020
2121(((programming language)))But we have not yet found a good way to use
5757(((programming,difficulty of)))Besides explaining JavaScript, I also
5858want to introduce the basic principles of programming. Programming, it
5959turns out, is hard. The fundamental rules are typically simple and
60- clear. But programs, built on top of these basic rules, tend to become
61- complex enough to introduce their own rules and complexity. You're
62- building your own maze, in a way, and you might just get lost in it.
60+ clear. But programs built on top of these rules tend to become complex
61+ enough to introduce their own rules and complexity. You're building
62+ your own maze, in a way, and you might just get lost in it.
6363
6464(((learning)))There will be times at which reading this book feels terribly
6565frustrating. If you are new to programming, there will be a lot of new
@@ -115,7 +115,7 @@ that this complexity is best managed by using only a small set of
115115well-understood techniques in their programs. They have composed
116116strict rules (_“best practices”_) prescribing the form programs should
117117have, and the more zealous among them will consider those that go
118- outside of this little safe zone to be _bad_ programmers.
118+ outside of this safe little zone to be _bad_ programmers.
119119
120120(((experiment)))(((learning)))What hostility to the richness of
121121programming—to try to reduce it to something straightforward and
@@ -248,6 +248,8 @@ operations `range` and `sum` available, which respectively create a
248248((collection)) of numbers within a range and compute the sum of a
249249collection of numbers:
250250
251+ // start_code
252+
251253[source,javascript]
252254----
253255console.log(sum(range(1, 10)));
@@ -275,10 +277,10 @@ indexsee:[WWW,World Wide Web] indexsee:[Web,World Wide Web](((history)))(((Netsc
275277application)))(((JavaScript)))(((JavaScript,history of)))(((World Wide
276278Web))) JavaScript was introduced in 1995, as a way to add programs to
277279Web pages in the Netscape Navigator browser. The language has since
278- been adopted by all other major graphical web browsers. It has made
279- the current generation of web applications—browser-based
280- email clients, maps, and social networks—possible and is also used in more
281- traditional sites to provide various forms of interactivity and
280+ been adopted by all other major graphical web browsers. It has made modern
281+ web applications possible, applications with which you can interact
282+ directly, without doing a page reload for every action. But it is also used in more
283+ traditional websites to provide various forms of interactivity and
282284cleverness.
283285
284286(((Java)))(((naming)))It is important to note that JavaScript has
@@ -294,7 +296,7 @@ Netscape, a ((standard)) document was written to describe the way the
294296JavaScript language should work, to make sure the various pieces of
295297software that claimed to support JavaScript were actually talking
296298about the same language. This is called the ECMAScript standard, after
297- the ECMA organization, which did the standardization. In practice, the
299+ the ECMA organization which did the standardization. In practice, the
298300terms ECMAScript and JavaScript can be used interchangeably—they are
299301two names for the same language.
300302
@@ -367,24 +369,28 @@ endif::interactive_target[]
367369
368370ifdef::book_target[]
369371
370- (((download)))(((sandbox)))(((running code)))Most of the example code
371- in this book can be found on the book's ((website)), at
372+ (((download)))(((sandbox)))(((running code)))The easiest way to run
373+ the example code in the book, and to experiment with it, is to look it
374+ up in the online version of the book at
375+ http://eloquentjavascript.net/[_eloquentjavascript.net_]. There you
376+ can click on any code example to edit and run it, and to see the
377+ output it produces. To work on the exercises, go to
372378http://eloquentjavascript.net/code[_eloquentjavascript.net/code_],
373- which also provides an easy way to run the programs and experiment
374- with writing your own code .
379+ which provides starting code for each coding exercise, and allows you
380+ to look at the solutions .
375381
376382endif::book_target[]
377383
378- (((developer tools)))(((JavaScript console)))Running JavaScript
379- programs outside of this book's sandbox is also possible. You can opt
380- to install ((Node.js)) and use it to run text files that contain
381- programs. Or you can use your browser's developer console (typically
382- found somewhere under a “tools” or “developer” menu) and play around
383- in there. In link:12_browser.html#script_tag[Chapter 12], I explain
384- the way in which JavaScript programs are embedded in web pages (HTML files).
385- You could also try websites like http://jsbin.com[_jsbin.com_]
386- which provide a friendly interface for running JavaScript code in a
387- browser .
384+ (((developer tools)))(((JavaScript console)))If you want to run the
385+ programs defined in this book outside of the book's sandbox, some care
386+ is required. Many examples stand on their own, and should work in any
387+ JavaScript environment. But code in later chapters is mostly written
388+ for a specific environment (the browser or Node.js), and can only run
389+ there. In addition, many chapters define bigger programs, and the
390+ pieces of code that appear in them depend on each other or on external
391+ files. The http://eloquentjavascript.net/code[sandbox] on the website
392+ provides links to zip files containing all of the scripts and data
393+ files necessary to run the code for a given chapter .
388394
389395== Typographic conventions ==
390396
0 commit comments