執行 ❯
建立您
自己的
網站
×
更改方向
儲存程式碼
更改主題, 深色/淺色
前往 Spaces
<!DOCTYPE html> <html> <body> <h1>JavaScript Arrays</h1> <h2>The entries() method</h2> <p>entries() returns an Array Iterator object with key/value pairs:</p> <p id="demo"></p> <script> const fruits = ["Banana", "Orange", "Apple", "Mango"]; const f = fruits.entries(); for (let x of f) { document.getElementById("demo").innerHTML += x + "<br>"; } </script> <p>The entries() method is not supported in Internet Explorer 11 (or earlier).</p> </body> </html>