运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 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>