Dos and Donts: Best Practices When Learning JavaScript




With every programming language, there’s a list of best practices; do’s and don’ts. JavaScript is no exception. Some of these best practices are there for your protection (like always always always using semi-colons!), some to make your code more readable and less error-prone, and some to increase the efficiency of your code.

Don’t miss an upload! Subscribe! http://goo.gl/szEauh
Stay Connected to O’Reilly Media by Email – http://goo.gl/YZSWbO

Follow O’Reilly Media:
http://plus.google.com/+oreillymedia
https://www.facebook.com/OReilly


Original source


19 responses to “Dos and Donts: Best Practices When Learning JavaScript”

  1. I went through everything on JavaScript at 3wschools, I can use all of them individually but still can't build any meaningful app. I can change contents on DOM, change styles, change image SRC but that is where it ends. where can I learn advance stuffs, like building a real life app

  2. I tried this and does not work inside my body:

     <script>
          function arrayFromObject (obj) {
         var theArray = [];
     var i = 0;
     for (var key in obj) {
        theArray[i] = 0;
    i++;
     }
     return theArray;
      }
      </script>

  3. She forgot 1 at the example at 10:26:
    it's faster to declare a variable storing the length of an array (exept when you add elements to the array and need the new length) like this:
    for (var i = 0, len = myArray.length; i < len; i++) {

  4. I think that there is an error in that first example of choosing good variable names.
    This will cast all values of the object as 0
    Should the line theArray[i] = 0 not be
    theArray[i] = obj[key];

  5. The narrator is sooo professional and then, at 8:23, with a barely detectable break in her demeanor:  "… something called Automatic Semi-Colon Insertion.  It sounds complicated and perhaps a little painful…"  I love that she did that 🙂  Very funny  

Leave a Reply