“How do I get better at JavaScript?”

It’s a question I get asked pretty often.

For the past few years, my answer has always been: “Roll your own x”, where possible values of x include jQuery, Backbone, Redux, a DNS server, Express, Handlebars, Mocha, a reverse proxy, etc.

I’m not saying anyone needs to make a fully API-compatible jQuery clone, and I’m definitely not saying that you should try to use it in production (although, YOLO). But what I am saying is that building low to medium-fidelity versions of these things will introduce you to the kinds of problems that…


Last year I wrote a post called “How to impress me in an interview”, and in it, I mentioned that I run across a lot of candidates (the vast majority, actually) who don’t really understand how prototypes work.

In a way, that’s kind of an amazing testament to how flexible JavaScript is, and how user-friendly many of today’s popular libraries are. I can’t think of many other object-oriented languages where an engineer can be reasonably productive without being at least vaguely aware of classes.

But here’s the thing: if you write JavaScript even semi-regularly, you really should understand how prototypal…


I interviewed at a company late last year that was having a lot of trouble on the front end.

Their apps were unmaintainable. Code quality was poor. Build processes were slow and messy. Nothing was really standardized.

They knew they had a problem, and were looking for a senior engineer to come on board and help get things pointed in the right direction – but they also had a few ideas of their own on how to fix things:

“We’re gonna switch from [Framework X] to [Framework Y]”

I immediately knew that I wouldn’t be able to help, because as…


In the past few years, I’ve done kind of a 180° on unit tests.

There are a lot of really easy ways to rationalize not testing your code, and I’m probably guilty of saying each of them at one point or another.

  • “It takes too much time”
  • “That’s what QA is for”
  • “A passing test suite doesn’t guarantee that you don’t have bugs”
  • “I tested it myself before I committed to master”
  • “[some feature I’m working on] isn’t really testable”

For some engineers, I think the reluctance to embrace unit testing is basically just FUD. …


I’m just gonna get this out of the way right up front, because people get really angry otherwise:

Consider this post as a series of learning exercises. These examples are designed to make you think — and, if I’m doing it right, maybe expand your understanding of functional programming a little bit.

Hey, dawg. I heard you like recursion, so I put a “Hey, dawg. I heard you like recursion, so I put a “Hey, dawg…

Loosely defined, recursion is the process of taking a big problem and sub-dividing it into multiple, smaller instances of the same problem.

Put into practice, that generally means writing a function that calls itself. Probably the most classic example of this concept is the factorial function.

You may…


In yesterday’s post, I wrote about the Note class in TinyMusic, and covered some of the basic music theory behind it. Today, I’ll cover the Sequence class and discuss some Web Audio API basics like audio contexts, oscillators, and scheduling.

If you didn’t read part 1, you really should go back and do that, because this post references a lot of stuff from it.

The Sequence Class

In TinyMusic, Note instances are strung together and have their playback controlled by a Sequence. Each Sequence has a tempo, volume control, and some basic EQ.

There are a couple different ways to instantiate a Sequence:


About a year ago, a few co-workers and I decided that we’d all participate in js13k. If you’re not familiar, js13k is a game competition where each entry has to be smaller than 13 KB.

Being a musician, it felt important that my game would have music. After looking around a bit, I wasn’t able to find any libraries that really did what I wanted without totally blowing the 13 KB budget. So I decided to make my own.

This post is the first of two parts. In it, I’ll explain the Note class in TinyMusic. …


I have a pretty serious fear of public speaking.

I start yawning a lot. My heart rate becomes elevated. I’m pretty sure my face turns red. It’s gotten a lot better with age — but still, it’s not great.

Anyway.

About two years ago, while I was working at Aereo, I had the enlightened idea that we should start doing a Lunch & Learn once a week. I sent out an email to see if anyone was interested, and the response was overwhelmingly positive.

I’m sure you can see where this is going.

Since I was the one who made…


Okay, fine. That title is horrible. But we’re all competing with BuzzFeed for readers now, and I needed something catchy, so here we are.

Right, then.

So, what is Object#valueOf and why should you care?

More or less, it’s a method that JavaScript calls automatically any time it sees an object in a situation where a primitive value is expected.

Let’s look at a quick example.

var obj = {};console.log( 7 + obj ); // “7[object Object]”

Plenty has been written about the insanity of implicit type conversion in JavaScript, so I’m really not interested in going down that…


I’ve been thinking a lot lately about functional programming, and I thought it might be kind of fun to walk through the process of writing a curry function.

For the uninitiated, currying refers to the process of taking a function with n arguments and transforming it into n functions that each take a single argument. It essentially creates a chain of partially applied functions that eventually resolves with a value.

Here’s a basic example of how you’d use it:

function volume( l, w, h ) {
return l * w * h;
}
var curried = curry( volume );curried(…

Kevin Ennis

Director of Engineer and founding team member @StarryInternet. Formerly @Aereo. @kevincennis on Twitter and Github. http://kevvv.in

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store