diff --git a/JavaScript_Enlightenment.html b/JavaScript_Enlightenment.html new file mode 100644 index 0000000..f7377c5 --- /dev/null +++ b/JavaScript_Enlightenment.html @@ -0,0 +1,93 @@ + + + + + + JavaScript_Enlightenment.pdf + + + + + + +
+
+
+

Preface

+ +

Before you begin, it is important to understand various styles employed in this book. Please do not + skip + this section, because it contains important information that will aid you as you read the book.

+ +

More code, less words

+ +

Please examine the code examples in detail. The text should be viewed as secondary to the code + itself. + It is my opinion that a code example is worth a thousand words. Do not worry if youʼre initially + confused + by explanations. Examine the code. Tinker with it. Reread the code comments. Repeat this process + until the concept being explained becomes clear. + I hope you achieve a level of expertise such that welldocumented code is all you need to grok + a programming concept.

+ +

Exhaustive code and repetition

+ +

You will probably curse me for repeating myself and for being so comprehensive with my code + examples. And while I might deserve it, I prefer to err on the side of being exact, verbose, and + repetitive, rather than make false assumptions authors often make about their reader. Yes, both can + be + annoying, depending upon what knowledge you bring to the subject, but they can also serve a useful + purpose for those who want to learn a subject in detail.

+ +

Color-coding Conventions

+ +

In the JavaScript code examples (example shown below), orange is used to highlight code directly + relevant to the concept being discussed. Any additional code used to support the orange colored code + will be green. The color gray in the code examples is reserved for JavaScript comments (example + shown below).

+ +
<!DOCTYPE html><html lang="en"><body><script>
+// this is a comment about a specific part of the code
+var foo = 'calling out this part of the code';
+</script></body></html>
+ +

In addition to code examples being color-coded, the text in this book is colored so as to denote + JavaScript words/keywords v.s. JavaScript code v.s. regular text. Below, I take an excerpt from the + book to demonstrate this coloring semantic.

+ +

"Consider that the cody object created from the + Object() constructor function (i.e var cody = new + Object()) is not really different from a string object created via + the String() constructor function. To + drive this fact home, examine the code below:"

+ +

Notice the use of gray italic text for code references, orange text for JavaScript words/keywords, and + regular black text for everything in-between.

+ +

jsFiddle, JS Bin, and Firebug lite-dev

+ +

The majority of code examples in this book are linked to a corresponding jsFiddle page, where the code + can be tweaked and executed online. The jsFiddle examples have been configured to use the + Firebug + lite-dev plugin so that the log function (i.e. console.log) will work in most any modern browser + regardless of if the browser has its own console. Before reading this book make sure you are + comfortable with the + usage and + purpose of console.log.

+ +

In situations where jsFiddle & Firebug lite-dev caused complications with the JavaScript code + JS Bin & Firebug Lite-dev will be used. + I've tried to avoid a dependency on a browser console by using Firebug + lite-dev but with certain code examples the solution itself gets in the way of code execution. In these + situations the console built into your web browser will have to be leveraged to output logs. If you are not + using a browser with a built in JavaScript console I would suggest + upgrading or switching browsers.

+ +

When JS Bin is used, keep in mind that the code has to be executed manually (clicking 'Render') which + differs from the page load execution done by jsFiddle.

+
+
+
+ + + diff --git a/css/main.css b/css/main.css new file mode 100644 index 0000000..20dd51c --- /dev/null +++ b/css/main.css @@ -0,0 +1,95 @@ +html { + background: #ccc; + font: 14px/1.5 "Tahoma", sans-serif; +} +h1 { + color: #444; + font: normal 36px "Helvetica", sans-serif; + text-align: right; + border-bottom: 3px solid #EAEBEB; + padding-bottom: 15px; + margin: 0 0 106px; +} +h2 { + font-size: 18px; + margin: 60px 0 21px; + padding-bottom: 11px; + color: #444; + border-bottom: 2px solid #EBECEC; +} +p { + margin: 0 0 34px 0; +} +pre { + margin: 0; +} +@media screen { + .code:before { + content: ' '; + height: 15px; + margin-bottom: 15px; + background: #FDECAD; + display: block; + } + .code:after { + content: ' '; + height: 4px; + margin: 11px 0 34px; + background: #FDD95D; + display: block; + } +} +code { + color: #37571e; + font-family: Courier, "Courier New", monospace; +} +code .comment { + color: #7a7; +} +code .string { + color: #b45e09; +} +.pdf {} +.pdf .page { + width: 788px; + background: #FFF; + margin: 5px auto 30px; + position: relative; + padding: 56px 75px; + box-sizing: border-box; +} +.pdf .body {} +.pdf .footer { + position: absolute; + bottom: 0; + left: 0; + width: 100%; + height: 38px; +} +.pdf .footer .page-num { + text-align: center; +} + +@media print { + .pdf .page { + width: auto; + height: auto; + background: #FFF; + margin: 0; + position: static; + padding: 0; + box-sizing: content-box; + } + .visible-screen { + display: none; + } + .code { + border-top: 15px solid #FDECAD; + border-bottom: 4px solid #FDD95D; + margin: 10px 0 15px 0; + } + a:after { + content: " (" attr(href) ") "; + font: normal 0.8em; + } +} \ No newline at end of file