6 October 2020

What is JavaScript ?

A brief description of JavaScript, with 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.

Thanks for taking the time to read this!

If you enjoyed it, and think others would benefit from the read then feel free to share it on Twitter (or elsewhere). I’m always up for a discussion about anything I’ve written too, so get in touch if you want to chat!

If you’ve spotted something out of place or something needs correcting, feel free to let me know.

A newer entry What about CSS ?

15 October 2020 A brief description of CSS, before suggesting a couple free courses.

An older entry What is HTML ?

6 September 2020 A brief description of HTML, before suggesting a couple free courses.