To find out how many items there are in an array, use count. Type and run the following code:
// count returns the number of items in an array
shoppingList.count
2 is displayed in the Results area.
You can check whether an array is empty by using isEmpty. Type and run the following code:
// isEmpty returns true if an array is empty
shoppingList.isEmpty
false is displayed in the Results area.
Now, let's see how to add items to arrays.