Go to the previous lesson

Bringing behaviour

JavaScript is a programming language and allows us to turn static web pages into apps.

Programming is breaking down behaviour. All behaviour can be broken down into three things:

information, a flow of logic, and actions

Think about it. All behaviour – even human behaviour – is comprised of these three things.

In programming we refer to information, logic and actions as:

variables, logic, and functions

A variable is used to store information. Once information is stored in a variable, it can be reused many times.

variable = data;

Logic allows us to check whether certain things are true or false. We check using conditional statements. If the conditon is met, the desired action will be performed, else a different action will be performed instead.

perform action
perform a different action

Functions store behaviour for reuse. We use variables and a flow logic in a function to create a bigger piece of behaviour that we can use again and again.

function name(){
variables and logic

Every programming language is based on these three fundamental but basic concepts.

Have a play with the code below – you can't break it! We think you'll find it's more fun than you thought :)

Go to the next lesson


the web page

New Window
Next Section