What is JavaScript? JavaScript is a type of computer programming language that is used to create interactive results within web browsers. So what is a variable in JavaScript? The definition of a variable is put simply as “a name of storage location”, and can be used to store data. You create or “declare’ a variable by using “var” or “let” and then you give it a type, a name, and a value. This basically just states what the purpose of the variable is.
To initialize a variable you put variableName= value;. The variableName is where you will put “var” or “let”. That will be your expression. Howecer, when writingan expression, there is a difference between “initializing” a variable and “declaring” it. When intializing a varible, you are just giving it a value. When you declare a variable, you are giving it a name and a type. It is important to note that you must initialize a variable before you initiate it, otherwise you will recieve an error message. However you do not need to initialze a variable before declaring it.