This example proposes only one single JavaScript function for:
- Creating a Database, for storing customers (a customer has a social security number (property "ssn"), a name, an age and an email)
- Creating an object store in that dataBase,
- Specifying a keyPath (a property in the objects stored that will act as a Primary Key, in our case the social security number),
- Adding two indexes for faster retrievals (one on the name, one on the email (unique) property of each object),
- Populating the dataBase with three entries.
Press the following button for calling the createDatabase() JavaScript function. Then look at the debugging console (with Chrome: F12 + Resources tab)