Lesson 2 of 50

JavaScript Variables

Variables are used to store data in JavaScript. They allow your program to remember information and use it later.

Creating Variables

JavaScript provides three ways to create variables: let, const, and var.

let name = "Yusuf";
const country = "Nigeria";
var age = 25;

Using Variables

Once a variable is created, you can use it anywhere in your code.

document.write("My name is " + name);
← Previous Next Lesson →