A variable can be created in a number of ways, but the most common is to use the keyword var followed by the name you want to give to the variable. For example:
var x = 5;
This code would create a variable called x and store the value 5 inside of it.
You can also use variables to store strings of text by surrounding the text in quotation marks. For example:
var y = “Hello”;
The way you name your variables is important too. They should be short but descriptive, so you can easily remember what they are for when you come back to your code at a later date.
Arithmetical operators allow you to perform mathematical operations on two values, and logical can compare two values and return a Boolean value (true or false).
If you’re not familiar with conditionals, they allow your code to execute different actions depending on whether a given condition is true or false.
The other is a switch statement, which allows you to select one of several code blocks to execute, based on the value of an expression.