function advanceResult() {
list.textContent = "";
const transaction = db.transaction(["rushAlbumList"], "readonly");
const objectStore = transaction.objectStore("rushAlbumList");
objectStore.openCursor().onsuccess = (event) => {
const cursor = event.target.result;
if (cursor) {
const listItem = document.createElement("li");
listItem.textContent = `${cursor.value.albumTitle}, ${cursor.value.year}`;
list.appendChild(listItem);
cursor.advance(2);
} else {
console.log("Every other entry displayed.");
}
};
}IDBCursor: advance() method / notebook
IDBCursor: advance() method
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.