Why do we write const for arrays and objects ?

We use const for arrays and objects to prevent reassigning the variable to something else. It means you can change the contents (like add/remove items in array or update object properties), but you cannot assign a new array or object to that variable. This helps avoid mistakes in code.

Revision of Yesterday

Arrays of Objects

1. Library Books

Create an array of 6 books. Each book should have:

Print the titles of all books by a particular author you like.


2. Movie Collection

Create an array of 5 movies with: