当前位置:网站首页>Symbol. Iterator iterator
Symbol. Iterator iterator
2022-06-24 09:50:00 【Time202051】
iterator Role is : Deconstruction of traversal data is not supported " Ergodic "
let courses = {
allCourse: {
frontend: ["ES", " Applet ", "Vue"],
backend: ["java", "Python"],
webapp: ["android", "IOS"],
},
};
courses[Symbol.iterator] = function () {
let allCourse = this.allCourse;
let itemKey = Object.keys(allCourse);
let values = [];
return {
next() {
if (!values.length) {
if (itemKey.length) {
values = allCourse[itemKey[0]];
itemKey.shift();
}
}
return {
done: !values.length,
value: values.shift(),
};
},
};
};
for (let item of courses) {
console.log(item);
}
// Print the content
/*ES Applet Vue java Python android IOS*/
Get we can get the array traversal separately and then splice . But if the project is used more , I have to go through logic every time . So add iterators directly . This is direct for of You can traverse it directly
边栏推荐
猜你喜欢

NVIDIA's CVPR 2022 oral is on fire! 2D images become realistic 3D objects in seconds! Here comes the virtual jazz band!

Why is LNX of e equal to X

Ggplot2 color setting summary

GeoGebra 实例 时钟

Learn Tai Chi Maker - esp8226 (12) esp8266 multitasking

深度学习论文阅读目标检测篇(七)中英对照版:YOLOv4《Optimal Speed and Accuracy of Object Detection》

canvas 绘制图片

IDEA 无法保存设置 源根 D:XXXX在模块XXX中重复

e的lnx为什么等于x

Jcim | AI based protein structure prediction in drug discovery: impacts and challenges
随机推荐
Leetcode-- string
PostgreSQL
20、 Processor scheduling (RR time slice rotation, mlfq multi-level feedback queue, CFS fully fair scheduler, priority reversal; multiprocessor scheduling)
Prct-1400: failed to execute getcrshome resolution
Servlet fast foundation building
Analysis of 43 cases of MATLAB neural network: Chapter 32 time series prediction of wavelet neural network - short-term traffic flow prediction
About thinkphp5, use the model save() to update the data prompt method not exist:think\db\query- & gt; Error reporting solution
医学图像开源数据集汇总(二)
Software system dependency analysis
Jcim | AI based protein structure prediction in drug discovery: impacts and challenges
How do novices choose the grade of investment and financial products?
5分钟,客服聊天处理技巧,炉火纯青
js单例模式
PHP使用递归和非递归方式实现创建多级文件夹
linux下oracle服务器打开允许远程连接
转:三星电子CEO:一切决策都要从认清自己开始
达梦数据库如何定位锁等待问题解决方法
threejs的 mmd模型加载+轮廓加载+动画加载+音频加载+相机动画加载+ammojs加载 gltf模型的加载 +gltf的反射调整
使用Live Chat促進業務銷售的驚人技巧
Five heart matchmaker