To programmatically empty browser cache with JavaScript, we call the caches.delete method.
For instance, we write
const keyList = await caches.keys();
await Promise.all(keyList.map((key) => caches.delete(key)));
to get a promise with the cache keys with caches.keys.
Then we delete the cache values with the given key with caches.delete.