What is an array?
Arrays are object type data structures in order to store multiple pieces of information in one place like normal objects.
There are some key differences though:
1. Arrays are not a data type on their own. In reality they are objects.
2. They don't use a named index with keys and values but an index number, in order to store and retrieve info that begins from 0. This is index defines and reveals the position of a piece of info in the array.
3. Syntax also differs and square brackets are used instead of curly braces. Arrays are used mostly in order to store information into one place, information that is relevant to one thing and one thing only. For example all the test scores of the class, all the heights of the students etc. That does not mean that multiple data types cannot be stored of course.
4. Arrays can be iterated like objects.
5. Arrays have their own methods for manipulating, extracting and inserting data as well.
6. For more info check this one.
On the example above you can see the creation of two arrays. In line number 4 we created an array that holds all the students' names of a single class. Below another array was created that holds information for a previous exercise regarding the creation of a cashier prototype. Although as you can see having different data types stored inside an array is possible, maybe it's not the most optimal way to do it, as it's not clear what these values represent due to the missing key that an object literal provides.
So as general rule, is always preferable to use arrays for holding values, that is clear what they represent without having a key for identifying them. Otherwise we may want to go for object literals.