Introduction to JavaScript

These notes introduce the JavaScript programming language. We focus on JavaScript as a general programming language itself, rather than looking at the use of JavaScript within webpages and using Web APIs to add dynamic and interactive content to webpages; this is covered in another set of notes.

We look at the syntax and fundamental structures of the language and how we write JavaScript code to solve well understood problems.

If the embed above does not work here is a link to the full version of the video

Writing JavaScript

We write JavaScript code as plain text, as a set of statements.

Each statement is ended by a semi-colon ;.

JavaScript code is case sensitive.

It includes blocks of code, denoted using curly braces { ... }.

JavaScript does not care about whitespace. You can write JavaScript entirely without whitespace, though there are some standard conventions about where we put spaces and new lines, and we’ll see examples of that as we learn the language.

JavaScript is interpreted and executed by a JavaScript engine. We can find a JavaScript engine inside every web browser, and can also find them in tools that run on the desktop, like node.

Further reading

The Mozilla Developer Network (MDN) has some good introductory articles on HTML and CSS. MDN is a very good resource for web developers, it covers a lot of web technologies in depth and is fairly reliable, though given recent changes in Mozilla, it is currently under threat. For now though, it still exists, and so MDN should be one of the first places you look for documentation/tutorials on web technologies.

In addition to the MDN tutorials and reference, Eloquent JavaScript is a really nice book that covers the language as well as using JavaScript on the web (both front-end and server-side), and you can read it all here:

Code examples

There are a set of code examples that accompany this course showing the use of JavaScript. (Right click and open in a new window/tab) if you’re viewing this on Learning Central.