运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,暗色/亮色
转到 Spaces
<!DOCTYPE html> <html> <body> <h1>JavaScript Sets</h1> <h2>The delete() Method</h2> <p>The delete() method removes a value from a set.</p> <p id="demo"></p> <script> // Create a new Set const letters = new Set(["a","b","c"]); // Remove Element letters.delete("a"); // Display set.size document.getElementById("demo").innerHTML = "The set has " + letters.size + " values."; </script> </body> </html>