Variables and the Console
You can use the console to play and experiment with JavaScript.
First, in your JavaScript editor, define some variables.
Variables are like "handles" that we can create to "hold on" to a value that a program will use.
- We use the word
const
to declare a variable that is not going to change.
const cats = 3;
const dogs = 4;
Click the "console" button at the bottom of the page.
Type
dogs
into the console and see what happens. You should see:
> dogs
4