querySelector Quirks 1

Unless you’re supporting IE7 or less, you should be using¬†querySelector and¬†querySelectorAll. You just should. caniuse.com says it’s okay. And there’s MDN documentation on the matter. Here are some links. Read them, and love everything about QS(A). caniuse.com MDN – document.querySelectorAll MDN – Element.querySelectorAll Good stuff, but there is one little oddity that a StackOverflow user ...

JavaScript: A Love Letter 3

When we first met, I was young. I was awkward and foolish and uncomfortable with myself. I didn’t know where I was going, who I would become, or how I would affect the world. In short, we were perfect for each other. I remember that quirky little language that fascinated me with image rollovers, dates, ...

The Illusion of Class 10

This indirection was intended to make the language seem more familiar to classically trained programmers, but failed to do that, as we can see from the very low opinion Java programmers have of JavaScript. JavaScript’s constructor pattern did not appeal to the classical crowd. It also obscured JavaScript’s true prototypal nature. As a result, there ...

The Initializer Pattern 7

If you haven’t read my previous tutorial on Objects and The Prototype Chain, it would be a good idea to do so. This article builds on the concepts presented there. Object oriented programming with only those concepts, while possible, can get pretty verbose, so we often use common abstraction techniques – called Design Patterns – ...

Markov Chains: The Sad Case of Mr. Markov and What’s His Face 2

“Whaaa? Markov Chains? aint nobody got time fo dat!” “Be silent!” They say that if you have a room full of monkeys bashing on typewriters, you’ll eventually get The Bible/Hamlet/the IKEA catalog. But they say a lot of things, so we’re going to make these monkeys. And not just any old type of monkeys – ...

Objects and the Prototype Chain 6

JavaScript is a language of objects. Everything is an object, and even those things that aren’t objects are often automatically converted to objects when they need to be. So, learning how to work with objects is an important part of becoming a better JavaScript programmer. If you’ve been writing JavaScript at all, then you’ve used ...

Fibonacci, an introduction to recursion 2

Recursion can be as simple as: It is as simple as that, or so you think… The most common way I have seen that recursion is taught is by learning how to code Fibonacci numbers. Fibonacci numbers are like so: 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, .., where the next number ...