Programming and Web Pages

We will be starting to work with JavaScript, which is a programming language that is incorporated into web browsers and can be used on web pages.

That sentence had a lot in it, and deserves some more explanation…

Programming Languages

JavaScript is a programming language. Some others you might have heard of are C, Python, Java, and C#. In general, a programming language is a way to describe to a computer some behaviour: some calculation or other action that you want to computer to do for you. That is, a programming language describes a program.

There are many different programming languages, all with their own strengths and weaknesses, but they fundamentally all do the same job of letting the programmer express instructions for some behaviour. They have to do this in a precise-enough way that the computer can actually follow them.

Compare this to some other languages we have seen for computers: HTML and CSS. Both of those are computer “languages” but they are not programming languages since they aren't used to create programs. (They are a document markup language and a visual style language, respectively.)

Behaviour on Web Pages

JavaScript is a programming language that is implemented in modern web browsers. That is, you can include JavaScript code as part of a web page or site and the web browser used to display the page will run the code.

The kind of “behaviour” we want in web pages can vary quite a lot. JavaScript code can modify the current HTML page (adding, removing, or changing content), respond to user events (like entering some text, or clicking somewhere), and can put those things together with logic expressed in programs.

In this course, we will explore a few things that can be done with JavaScript. There is certainly much more than can be covered in one course, but hopefully you will at least get a sense for what can be done, as well as the basics of how to do it.

With the ability to introduce logic and behaviour into web pages comes the possibility of making pages that do very ugly and counter-intuitive things. That means that you can make very bad web pages with JavaScript, but with some good design you can make very flexible web pages too.

JavaScript can be used more generally as a programming language outside of web pages. We won't be discussing these applications in this course.