Variables
The very basics of JavaScript: How to save something inside a little token contained called a "variable"!
Let's assume for a second that you've never heard of JavaScript, you don't know the terminology or the syntax, you're basically starting from scratch. This page presents the most basic stuff you'll encounter.
Variables
A variable is a "container" for data, that can change (which is why it's "variable", get it?). Variables are declared by giving them a variable name, as well as value (or "content" or "data"). There are 3 ways to declare a variable:
Let's break down a single line here to look at the syntax:
let/var/const
are JavaScript keywords that triggers a new variable to be created.The variable name also called identifier is created. There are some limitations to identifier names, see this page for more details.
=
is an operator that means "insert whatever comes after me, into the variable before me"
Last updated