How to delete all items from a Collection using wix code

I have a collection and i want to delete all items from it when the user navigates to a page, i have used the code below in the onReady function of that page but it isn’t working, can someone help me out please.
(dataset1 is the dataset of the collection i want to remove all items from)

$w.onReady(function () {
$w(“#dataset1”).onReady(async() => {
if ($w(“#dataset1”).getCurrentItem()) {
await $w(“#dataset1”).remove();
while ($w(“#dataset1”).hasNext()) {
await $w(“#dataset1”).next();
await $w(“#dataset1”).remove();
}
}
});
});