All Posts

WTF is JavaScript?

A brief description of JavaScript, with a few links to dig in and learn more.

I like to think of JavaScript as interactivity at runtime for web pages.

When you visit a typical web page in a browser, the structure and content are determined by HTML code sent from a web server. (See: How the Web Works.) That HTML code may also tell the browser to include one of more CSS files, which specify how the content on the screen is presented. (CSS adds style to HTML.)

JavaScript handles any functionality beyond what HTML and CSS can accomplish. That could include features like displaying the current time, animating objects based on scroll depth, or submitting a form without reloading the page. That's all JavaScript.

Consider if a web page were a birthday cake. HTML would be the collection of ingredients that make up the cake — the mixture and baking process which give the cake its structure. CSS would be the frosting on the cake and the dish it is served on — those things that determine if the cake is beautiful or not. JavaScript would be the candles on top. The fire that burns on those wicks is dynamic, melting wax as the fire approaches the icing.

But that's not the whole picture. That's what JavaScript used to be. That what it was in the early days of the web.

Today JavaScript is used for so much more. There are an array of popular client-side frameworks (e.g. React) that make it possible to build entire websites with only JavaScript code, effectively obfuscating the use of HTML and CSS.

And JavaScript can also be used on the server side with Node.js. That means it can not only power the interactivity on a website, but it can control what the web server sends to the browser. In other words, JavaScript can be used to build an entire website — the front-end and the back-end.

Because this isn't a full-fledged course on JavaScript, I'll stop here. If you're new to JavaScript and want to dig in further, consider taking a course like Codeacademy's Introduction to JavaScript or Wes Bos' Beginner JavaScript.

Social Links
Site References