Variables and Values in JavaScript
Understand the basics of Variables and Values

What are values?
Values are small chunks of data. They are the simplest unit of information in every single source code. Values come in different types. Let's see some examples of values so we can have a better understanding. These examples are grouped according to type;
Types of values
1. Numbers
for example;
1, 2, 548
2. Strings
for example;
"Your name"
3. Booleans
for example;
true
false
4. Undefined values
for example;
null
undefined
What are Variables?
Variables are basically storehouses for values. Now, let's make it really easy to understand. We store values inside variables.
So, let's imagine a box that can hold some objects for example; a box storing a book. From this example, the book is a value while the box is the storehouse for the value.
Why do we store values in variables?
We simply store values so we can refer to them at a later time. For example, we can refer back to the box storing our book
An example of a variable in Javascript
const fullName = "Harry Potter";
In the example above, just like the box stores the book, the variable(fullName) stores the value ("Harry Potter")
Guidelines to follow when naming variables
As beginners, the most important guide to follow when naming a variable is this; make sure that the variable name is descriptive. i.e let the variable describe what it is storing precisely (this will help you when you come back to practice or when you are working with other developers on a team. For example
let myFirstJob = "programmer";
let mySecondJob = "business man";
is more descriptive than:
let job1 = "programmer";
let job2 = "teacher";
Here are some other rules to stick to when naming variables (feel free to add some in the comments xDD)
- Variables should only contain numbers, letters, dollar sign or underscore(sometimes)
const year$ = 2022; - Variables with the upper case are reserved for constants that will never change.
For example;
let PI = 3.1415;

