Answer to Question #4617 in AJAX | JavaScript | HTML | PHP for Kristy667

Question #4617
What is the difference between arrays and variables?
Expert's answer
A variable is a container for a single number. A variable can be thought of as a box, the number of items in the box determines the value of the box, and the type of items in the box must be uniform.
An array is a collection of such boxes aligned together. The analogy is a medicine box that is specially designed so that it can only hold a specific type of medicine. Each partition in the box can contain any number of medicine (as long as the capacity permits), but you can only put in the medicine that the box is designed for. In an array, we use "index" to address each partition, an index is a number that uniquely identifies each partition in the medicine box.

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be the first!

Leave a comment

Ask Your question

New on Blog