时间:2021-07-01 10:21:17 帮助过:16人阅读

我们先来看一下entries函数的基本语法
array.entries();
它返回一个索引数组以及array.entries()函数将在其上运行的给定数组的值。
下面我们来看具体示例
array.entries()方法用于查找任何给定数组中每个索引的键和值对。
代码如下
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<script type="text/javascript">
var array = ["php", "gfg", "Jhon"];
var iterator = array.entries();
console.log(iterator.next().value);
console.log(iterator.next().value);
console.log(iterator.next().value);
</script>
</body>
</html>执行效果如下:

本篇文章到这里就全部已经结束了,更多精彩内容大家可以关注Gxl网的其他相关栏目教程!!!
以上就是entries函数怎么使用的详细内容,更多请关注Gxl网其它相关文章!