Variables are used to store one or more values on a computer program.
Imagine you have a box that stores 6 pieces of apple, but they are in different color, so you decide to group similar items together, and store them in boxes. This would allow you better access to each item (apple).
Now, you have three boxes, one with Red apples, one with Green apples, and another one with Yellow apples. You have to sort the right type of box to get the required item.
And finally, give a unique name to each box to make each one easer to identify.
This is how variables are working with data and here is an example :
var redApples = 2;
Follow me on Instagram