标签:done 迭代器 highlight item 完成 div 快捷 接口 html
Iterator 是 ES6 引入的一种新的遍历机制,迭代器有两个核心概念:
迭代的过程如下:
<script>
//Iterator是一种新的遍历机制,两个核心
//1.迭代器是一个接口,能快捷的访问数据,通过symbol,iterator来创建迭代器
//2.迭代器是用于遍历数据结构的指针
const item = ["one","two"];
const ite =item[Symbol.iterator]();
console.log(ite.next());//done如果为true是表示迭代完成
console.log(ite.next());
console.log(ite.next());//当迭代器完成以后value变为undefined;done为true
</script>
标签:done 迭代器 highlight item 完成 div 快捷 接口 html
原文地址:https://www.cnblogs.com/lixiang1013/p/13657750.html