请将下面这段简码重构为一个可重用的函数：

```JS
detailsbutton.addEventListener('click', () => {
    const deets = document.getElementById("deets");
    if (deets.style.display === "none") {
        deets.style.display = "block";
    } else {
        deets.style.display = "none";
    }
});```

将整个代码段重构为一个名为 `toggleDisplay` 的函数
user
```JS
function toggleDisplay(elementId) {
    const element = document.getElementById(elementId);
    if (element.style.display === "none") {
        element.style.display = "block";
    } else {
        element.style.display = "none";
    }
}

detailsbutton.addEventListener('click', () => toggleDisplay("deets"));
```
assistant