the IDBDatabase object in indexedDB has been generated but cannot call the createObjectStore method to create a namespace, prompting Uncaught TypeError: Cannot read property "createObjectStore" of undefined.
here is the code
var request = indexedDB.open("jusing"),
db;
user = {
username: "jusing",
age: 18,
gender: "male",
handsome: true
}
request.onsuccess = function() {
db = event.target.result;
}
var store = db.createObjectStore("users", {keyPath: "username"});
store.add(user);