A Tiny Introduction to JavaScript

These days, you can’t turn around twice without someone trying to teach you how to code. So why the heck did I write my own book?

When my daughters started learning to code, I discovered that most tutorials were as dry as dust. If you wanted something more fun, you could play a coding game and write commands to move a character around a maze (like a princess, a zombie, a turtle, whatever). But unlike real programming, there was no chance to be creative. There was no freedom. There was no invitation to build your own programs.

I wanted something different. Something…

  • Hands-on. If you want to learn a new skill, you need to practice. Otherwise, it’s just a bunch of theory swimming around in your head.
  • Friendly for beginners. If you’re a beginner, it’s not enough to learn the basics of a programming language like JavaScript. You also need to learn the concepts of programming at the same time.
  • No setup required. The world is full of amazing frameworks, tools, and code editors. But who wants to install a bunch of software before you even get started?
  • Tiny. I’m a programming nerd, so I like talking about things like Big O notation. But no one needs to be buried in theory at the start of their journey. In this book, every chapter is a bite-sized lesson that you can usually finish in one sitting.
  • Kinda fun. Not everyone has the motivation to learn from an old-fashioned textbook. But who doesn’t want to play dice with a cheating goblin?

So I decided to make something of my own. Then I unleashed it on my family.

This is the result of those experiments.

Why JavaScript?

Shouldn’t this be in Python or something? Well, not necessarily…

JavaScript is a great first language for people learning to code. It’s not because JavaScript is a great teaching language (it mostly isn’t). It’s because JavaScript is everywhere—on every operating system, every browser, and almost every electronic device that’s more complicated than a toaster.

That means you can effortlessly share your JavaScript programs with friends. Unlike all the rest of computing history, there’s no downloading, installing, or configuring. And it doesn’t hurt that JavaScript syntax is similar to many other professional languages, like Java and C#. That means the effort you spend to learn JavaScript is never wasted.

Why CodePen?

CodePen is one of several free JavaScript playgrounds that you can use in your browser. With CodePen, you can write JavaScript code, test it, and save it for later, without needing to set anything up. And all the pieces of your solution—the HTML that creates the page, the CSS that makes it look good, and the JavaScript that powers it—are brought together in one place. There’s no need to juggle separate files.

A Tiny Introduction to JavaScript uses CodePen for all its exercises. Usually, you’ll start with a project that’s already built, and then change it. Maybe you’ll need to make an enhancement or fix a problem. And when you’re finished, you can show your work to other people just by sending them a link.

Can adults read this book?

Sure, we don’t discriminate!

However, this book assumes you’re learning JavaScript and programming for the first time. If you already know a bit about programming, you’ll probably prefer a guide that focuses on the JavaScript language without re-introducing the concepts you already know.

Is this a coding game?

This is not a code simulation, game, code-themed activity, or coder cosplay. You’re going to write tiny amounts of Real Code™.

This is an important difference. Games can be fun, and they can teach people, too. But to start developing a programmer’s mindset, you need to write real code in an unbounded environment. Good luck!

Do you use modern JavaScript?

The focus of A Tiny Introduction to JavaScript is learning how to solve simple problems with code. There are plenty of neat tricks and practices we don’t cover, because I’m focused on the basics. That said, I avoid embarrassing old JavaScript habits, like using the var keyword. This isn’t your grandpa’s JavaScript. (Not a slight to grandpas; they’re awesome!)

How can I support the Tiny Introductions project?

Please enjoy this book guilt-free! Share it with your family! Give it to your friends! There’s no limit, so long as you don’t change it or pass it off as your own work.

If you find mistakes, please let me know. I greatly benefit from people pointing out problems I’ve missed, so they don’t frustrate other readers. Send me your complaints, comments, questions, and suggestions to matthew@prosetech.com.

If you feel particularly enthusiastic about the Tiny Introductions project, and you want to say thanks (or just encourage me to write more books in the series), you can buy your own copy of A Tiny Introduction to JavaScript. It’s available in print from Amazon or in a pay-what-you-can PDF on Gumroad. Thanks a bunch!