Variables are user-defined (meaning that you give it a name), human readable symbols we use in code to represent information (data) such as numbers, strings, input from a user, responses back from the server, etc.
Why? Imagine trying to write code that works with only literal values such as
Tonya. Your code becomes hard to work with and its not reusable for other values. Right?
Variable allow us to write more expressive, readable, and reusable code that doesn’t have to tied directly to one value or one piece of information.
We can write a program that takes variable information and then processes it.
For example, if you have a form where you want to get a response from the person viewing the web page, you could have him/her fill out the form field and then grab that variable information within your code. Maybe you want them to select their age. Their age could be 18, 30, or 55. It’s variable.
age. Use the keyword
Then use the equal sign to make an assignment for the value you want that new variable to represent.
You can learn more about variables here in in the lesson on Variables and on MDN: