Why Variable over Array?


If an array is just a variable with the capability of being able to use more than one value, why do variables exist instead of just having one value arrays?


With an array, you're creating more than you're really seeing, I think. We create variables so that we can easily call them instead of having a list in which the computer would have to go into the list and search what we're looking for rather than directly calling it. It's really about simplicity I believe and the option of having variables. If you've noticed, when you create arrays, in javaScript you still have to declare it a variable so that should tell you that everything is a type of variable.
It's kind of like asking "If a meter is just a measurement full of centimeters, then why do we use centimeters at all?" We need the smallest unit.
I'm by no means an expert, at all, these are just my thoughts on the topic and what I see when using it. :smile_cat:


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.