Variables

Variables can store a large variety of information.
They can store numbers: var x = 250;
They can store words: var name = "Teddy";
they can store boolean values: var crashed = true;

In order to declare a variable, we need to use the keyword var followed by the name of the variable
Afterwords we can reference it by using the name we gave it.

Example

var myNumber = 0;

myNumber = 10;

myNumber = myNumber + 5;

myNumber = myNumber * 2;

console.log(myNumber)

Variables courses

JavaScript for Scratchers

In this course we will transition from block-based Scratch programming into text-based JavaScript!

JavaScript for Scratchers

In this course we will transition from block-based Scratch programming into text-based JavaScript!

JavaScript Game Design

Learn the fundamentals of JavaScript by building your own game

JavaScript for Scratchers

In this course we will transition from block-based Scratch programming into text-based JavaScript!

Variables lessons

JavaScript for Scratchers 4: Animate Your House

In this lesson we are going to use what we learned about animation in JavaScript to animate the house we drew earlier in the course!

JavaScript for Scratchers 3: Animation

In this lesson we will learn about variables, if statements, operators, and the draw function so we can make things move around using JavaScript!

Variables

We will begin our understanding of JavaScript by looking at how to store data in memory

JavaScript for Scratchers 1: Drawing Shapes

Free Trial (5th - 7th)

Code Clicker JavaScript

Create a basic code clicker game

Related Links

No links found
About Variables

Variables store data which you can modify and then look at later.

Badge

Variables

Rank Requirements