JavaScript Tutorials

  • By
    Convert arguments to Array

    The arguments object thats automatically available within functions can be a source of confusion for some people; it's kind of an array but it's kinda not. JavaScript is awesome in that you can pass any number of arguments to a function, and oftentimes developers need to...

  • By
    Detect Pseudo-Element Animation Support

    A while back I posted an interesting tidbit from Daniel Buchner which allows developers to detect DOM node insertions with JavaScript and CSS animations; an awesome trick driven by CSS animations.  Lea Verou recently posted another detection snippet driven by CSS animations:  detecting pseudo-element...

  • By
    Get Element Attributes with JavaScript

    What I love so much about JavaScript is that the language is incredibly dynamic.  So dynamic that you can modify native objects if you so choose.  One dynamic property I've frequently been using lately is the attributes property of DOM elements.  This attributes property provides me...

  • By
    5 Common Usability Mistakes and Solutions For Avoiding Them

    I'm sort of a grumpy web user, but I think that's part of what drives me to be a good Web Developer.  I get so annoyed at things that make using a website difficult, things that should be basic.  Here's a list of five common usability...

  • By
    JavaScript Functions that Return Functions

    A few weeks back, I tweeted that I loved functions that returned functions. I got quite a few replies to the tune of....WTF?!  It's important that people understand the value of functions that return functions;  using this technique can save you code, JavaScript efficiency, and...

  • By
    Detect Vendor Prefix with JavaScript

    Regardless of our position on vendor prefixes, we have to live with them and occasionally use them to make things work.  These prefixes can be used in two formats:  the CSS format (-moz-, as in -moz-element) and the JS format (navigator.mozApps).  The awesome X-Tag project has...

  • By
    Making Sprite-based Games with Canvas

    The canvas element was introduced with HTML5 and provides an API for rendering on the web. The API is simple, but if you've never done graphics work before it might take some getting used to. It has great cross-browser support at this point, and...

  • By
    Convert NodeList to Array

    Now that most browsers have implemented querySelectorAll, the native selectorEngine, many framework-dependent developers are getting a rude awakening when dealing with the result of QSA calls:  the NodeList object.  NodeLists are array-like but don't feature many of the methods provided by the Array, like forEach, map...

  • By
    Install Chrome Store Web Apps with JavaScript

    Being able to install Firefox OS web apps from any domain, not just the platform app store, is a giant step forward in mobile app marketing and freedom.  Firefox OS allows installing apps from any or all domains, and it just so happens that...

  • By
    Remove an Item From an Array with JavaScript

    One operation that seems to be more difficult than it should be in every programming language is removing a value from an array.  It's such an easy concept mentally that it skews our programmatic view of the task.  In JavaScript the splice method is of huge help...