Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I learned to write JavaScript from reading Douglas Crockford's <a href="http://www.amazon.com/s/ref=nb_ss_2_6?url=search-alias%3Daps&amp;field-keywords=javascript+the+good+parts&amp;x=0&amp;y=0&amp;sprefix=javasc" rel="nofollow noreferrer">JavaScript: The Good Parts</a>. He also has <a href="http://video.yahoo.com/watch/630959/2974197" rel="nofollow noreferrer">a lot</a> of <a href="http://video.yahoo.com/watch/111593/1710507" rel="nofollow noreferrer">stuff</a> <a href="http://video.yahoo.com/watch/111585/1027823" rel="nofollow noreferrer">online</a> you can <a href="http://javascript.crockford.com/" rel="nofollow noreferrer">check out</a>.</p> <p>My basic style is to drop JavaScript's mechanisms for class creation and treat it more like Scheme by creating "objects" with closures and object literal notation. (Not sure if you have any background with Scheme; if not, this approach may feel less natural to you.) For a better explanation of how to do this, Crockford has a short essay <a href="http://javascript.crockford.com/private.html" rel="nofollow noreferrer">here</a>. Here's a short example:</p> <pre><code>var pezDispenser = (function () { var amount = 20; return { dispense: function () { if (amount &gt; 0) } amount -= 1; alert('delicious pez!'); } else { alert('no more pez!'); } } }; }()); pezDispenser.dispense(); </code></pre> <p>I've found this to be a pretty powerful and flexible approach.</p> <p>Crockford also has a general style guide for the language <a href="http://javascript.crockford.com/style1.html" rel="nofollow noreferrer">here</a> and <a href="http://javascript.crockford.com/style2.html" rel="nofollow noreferrer">here</a>.</p> <p>Hope this helps.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload