Skip to main content

Variables


You assign them with let and any variable assigned with let can be reassigned later on. If you want a static unchanging variable, use const instead.

It makes sense to start out with const and then move to let instead of the other way around.

Don't use var anymore. It's old and outdated.

Variables defined by let and const are block scoped

Define a var and increment it


//define a variable "count" with value 0
let count = 0;
//then increment it
count = count + 1; // or count += 1 orr count ++