• Don't let Hoisting Put Your Variables Up For Grabs

    JavaScript has a curious behavior if you're coming from another programming language. (Okay, JavaScript has a lot of curious behaviors regardless of whether you're coming from another language.) In particular, there's a curios behavior around the scope of variable declarations.

  • Sticky Search Fields

    If you've ever visited the Lowe's web site and performed a search, you may have noticed the site remembers your last search and pre-populates the search box with your last search string. How is this accomplished? It's a simple use of the browser's localStorage object.

  • Repackaging XMLHttpRequest

    The JavaScript fetch API has been around for a few years now, but a couple of browsers (Safari and iOS Safari, for example) have only supported it for a little over a year now. Prior to fetch, we used XMLHttpRequest to request data in JavaScript. If you're a bit late to the game because you're still supporting some of those older browser versions, here's a step-by-step guide for how XMLHttpRequest can be repackaged into the fetch API.

  • Running Through Arrays

    If you're new to JavaScript (or it's been a while since you looked at array iteration in JavaScript), you probably want to understand all the options that are available to you.

  • Getting Started

    "I want to become a web/mobile developer/designer. What can I do to get started?"

    Here are a few suggestions...

  • Working with Forms in Two Functions

    Interacting with forms - it's a common need in JavaScript apps. You need to gather information from the form when it's submitted; you need to initialize a form when it's first displayed to the user. Here's a simple form...

  • The (Proto)Typical JavaScript Function

    We've seen that constructor functions can be used to initialize JavaScript objects in a consistent manner. The constructor can be used to ensure that an object is always initialized with a known set of properties and default values for those properties. But it's also possible to assign functions to object properties from within a constructor function.

  • Constructing Constructor Functions

    When you are first learning JavaScript, you will be introduced to two ubiquitous language features: functions and objects. As you begin to experiment with creating objects, you may find it useful to implement a simple function to create commonly used object types. For instance, here's a function that will create an instance of a photo object...

  • Two Quick Steps to JavaScript Events

    If you're just starting out with JavaScript and want to respond to an event on the page, you can keep these two simple steps in mind.