Skip to content

Commit

Permalink
fixed some errata - thanks to @wlmeurer
Browse files Browse the repository at this point in the history
  • Loading branch information
maccman committed Jun 20, 2011
1 parent 7027c03 commit 5799126
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions coffeescript/01_syntax.html
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ <h1>CoffeeScript Syntax</h1>


<h2>Variables &amp; Scope</h2> <h2>Variables &amp; Scope</h2>


<p>CoffeeScript fixes one of the major bugbears with JavaScript, global variables. In JavaScript, it's all too easy to accidentally declare a global variable by forgetting to include <code>var</code> before the variable assignment. CoffeeScript solves this by simply removing global variables. Behind the scenes, CoffeeScript wraps up scripts with a anonymous function, keeping the local context, and automatically prefixes all variable assignments with <code>var</code>. For example, take this simple variable assignment in CoffeeScript:</p> <p>CoffeeScript fixes one of the major bugbears with JavaScript, global variables. In JavaScript, it's all too easy to accidentally declare a global variable by forgetting to include <code>var</code> before the variable assignment. CoffeeScript solves this by simply removing global variables. Behind the scenes, CoffeeScript wraps up scripts with an anonymous function, keeping the local context, and automatically prefixes all variable assignments with <code>var</code>. For example, take this simple variable assignment in CoffeeScript:</p>


<p><span class="csscript"></span></p> <p><span class="csscript"></span></p>


Expand All @@ -74,7 +74,7 @@ <h2>Variables &amp; Scope</h2>


<h2>Functions</h2> <h2>Functions</h2>


<p>CoffeeScript removes the rather verbose <code>function</code> statement, and replaces it with a thin arrow: <code>-&gt;</code>. Functions can be one liners, or indented on multiple lines. The last expression in the function is implicitly returned. In other words, you don't need to use the <code>return</code> statement unless you want to return earlier inside the function.</p> <p>CoffeeScript removes the rather verbose <code>function</code> statement, and replaces it with a thin arrow: <code>-&gt;</code>. Functions can be one liners or indented on multiple lines. The last expression in the function is implicitly returned. In other words, you don't need to use the <code>return</code> statement unless you want to return earlier inside the function.</p>


<p>With that in mind, let's take a look at an example:</p> <p>With that in mind, let's take a look at an example:</p>


Expand All @@ -96,7 +96,7 @@ <h2>Functions</h2>


<h3>Function arguments</h3> <h3>Function arguments</h3>


<p>How about specifying arguments? Well, CoffeeScript lets you do that by specifying arguments in a pair of parenthesis before the arrow.</p> <p>How about specifying arguments? Well, CoffeeScript lets you do that by specifying arguments in parentheses before the arrow.</p>


<p><span class="csscript"></span></p> <p><span class="csscript"></span></p>


Expand Down
6 changes: 3 additions & 3 deletions coffeescript/chapters/01_syntax.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ As I briefly alluded to, whitespace is significant in CoffeeScript. In practice,


##Variables & Scope ##Variables & Scope


CoffeeScript fixes one of the major bugbears with JavaScript, global variables. In JavaScript, it's all too easy to accidentally declare a global variable by forgetting to include `var` before the variable assignment. CoffeeScript solves this by simply removing global variables. Behind the scenes, CoffeeScript wraps up scripts with a anonymous function, keeping the local context, and automatically prefixes all variable assignments with `var`. For example, take this simple variable assignment in CoffeeScript: CoffeeScript fixes one of the major bugbears with JavaScript, global variables. In JavaScript, it's all too easy to accidentally declare a global variable by forgetting to include `var` before the variable assignment. CoffeeScript solves this by simply removing global variables. Behind the scenes, CoffeeScript wraps up scripts with an anonymous function, keeping the local context, and automatically prefixes all variable assignments with `var`. For example, take this simple variable assignment in CoffeeScript:


<span class="csscript"></span> <span class="csscript"></span>


Expand All @@ -47,7 +47,7 @@ In the root context, `this` is equal to the global object, and by creating a loc


##Functions ##Functions


CoffeeScript removes the rather verbose `function` statement, and replaces it with a thin arrow: `->`. Functions can be one liners, or indented on multiple lines. The last expression in the function is implicitly returned. In other words, you don't need to use the `return` statement unless you want to return earlier inside the function. CoffeeScript removes the rather verbose `function` statement, and replaces it with a thin arrow: `->`. Functions can be one liners or indented on multiple lines. The last expression in the function is implicitly returned. In other words, you don't need to use the `return` statement unless you want to return earlier inside the function.


With that in mind, let's take a look at an example: With that in mind, let's take a look at an example:


Expand All @@ -67,7 +67,7 @@ As mentioned earlier, there's no reason why the we can't use multiple lines, as
###Function arguments ###Function arguments


How about specifying arguments? Well, CoffeeScript lets you do that by specifying arguments in a pair of parenthesis before the arrow. How about specifying arguments? Well, CoffeeScript lets you do that by specifying arguments in parentheses before the arrow.


<span class="csscript"></span> <span class="csscript"></span>


Expand Down

0 comments on commit 5799126

Please sign in to comment.