当前位置:网站首页>Iterator Foundation
Iterator Foundation
2022-07-06 07:33:00 【Romantic bearded boy】
ES6 Before , The only data structures used to represent a group of data are arrays and objects .
const array = [1, 2, 3, 4];
const object = {
a: 1,
b: 2,
c: 3
}
ES6 in , added Set and Map Two data structures .
One 、 Code case
var it = makeIterator(['a', 'b']);
it.next() // { value: "a", done: false }
it.next() // { value: "b", done: false }
it.next() // { value: undefined, done: true }
function makeIterator(array) {
var nextIndex = 0;
return {
next: function() {
if(nextIndex < array.length) {
return {
value: array[nextIndex++], done: false }
}
return {
value: undefined, done: true }
}
};
}
边栏推荐
- If Jerry's Bluetooth device wants to send data to the mobile phone, the mobile phone needs to open the notify channel first [article]
- 成为优秀的TS体操高手 之 TS 类型体操前置知识储备
- Games101 Lesson 7 shading 1 Notes
- The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
- Oracle column to row -- a field is converted to multiple rows according to the specified separator
- Scala language learning-08-abstract classes
- [MySQL learning notes 32] mvcc
- 数字IC设计笔试题汇总(一)
- TS 类型体操 之 循环中的键值判断,as 关键字使用
- Three treasures of leeks and Chinese men's football team
猜你喜欢
智能终端设备加密防护的意义和措施
杰理之BLE【篇】
[cf gym101196-i] waif until dark network maximum flow
ORACLE列转行--某字段按指定分隔符转多行
【MySQL学习笔记32】mvcc
Three no resumes in the software testing industry. What does the enterprise use to recruit you? Shichendahai's resume
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
Seriously recommend several machine learning official account
JMeter performance test steps practical tutorial
Google may return to the Chinese market after the Spring Festival.
随机推荐
Wonderful use of TS type gymnastics string
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
[cf gym101196-i] waif until dark network maximum flow
成为优秀的TS体操高手 之 TS 类型体操前置知识储备
js對象獲取屬性的方法(.和[]方式)
Get/post/put/patch/delete meaning
Word setting directory
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
mysql如何合并数据
The difference between TS Gymnastics (cross operation) and interface inheritance
opencv学习笔记八--答题卡识别
Sharing of source code anti disclosure scheme under burning scenario
Bloom taxonomy
Ble of Jerry [chapter]
How Navicat imports MySQL scripts
Méthode d'obtention des propriétés de l'objet JS (.Et [] méthodes)
Ble of Jerry [chapter]
Bit operation XOR
Solution to the problem of breakthrough in OWASP juice shop shooting range
[CF Gym101196-I] Waif Until Dark 网络最大流