Introduction
Knowing the length of an array helps you understand how many items it holds so you can work with all of them safely.
When you want to loop through all items in an array.
When you need to check if an array is empty before using it.
When you want to allocate space or resources based on the number of items.
When you want to compare sizes of two arrays.
When you want to avoid errors by not accessing beyond the array's end.