JS——for...of...
来源:互联网 发布:ubuntu ftp传输文件 编辑:程序博客网 时间:2024/06/16 06:41
//The for...of statement creates a loop iterating over iterable objects (including Array, Map, Set, String, TypedArray, arguments object and so on), invoking a custom iteration hook with statements to be executed for the value of each distinct property.//循环遍历可以遍历的对象,包括(Array, Map, Set, String, TypedArray, arguments object等等)var arr=[5,6,7,8,9];for(var item of arr){console.log(item);}var str='abcdefg';for(var item of arr){console.log(item);}//不能遍历对象/*var per={name:"abc",age:20}for(var item of per){console.log(item); //报错}*//* ES6 借鉴 C++、Java、C# 和 Python 语言,引入了for...of循环,作为遍历所有数据结构的统一的方法。一个数据结构只要部署了Symbol.iterator属性,就被视为具有 iterator 接口,就可以用for...of循环遍历它的成员。也就是说,for...of循环内部调用的是数据结构的Symbol.iterator方法。for...of循环可以使用的范围包括数组、Set 和 Map 结构、某些类似数组的对象(比如arguments对象、DOM NodeList 对象)、后文的 Generator 对象,以及字符串。 */
阅读全文
0 0
- JS——for...of...
- js的forEach,for in , for of
- 04 ”Episode fxxkit “—.—JS遍历for..in/of Iterator
- JS迭代器之for-in(of)
- JS——for in
- For Fans of Statistics——vector
- 菜鸟系列——forEach、map、for...in、for...of
- ES6 —(Iterator 和 for...of)
- JavaScript—for...in 语句、for...of 语句
- 简述js中 for in 与 for of 区别
- js for in 和for of的区别
- js性能测试——for循环
- js笔记一:js中forEach,for in,for of循环的用法
- Three cases of js hover for more information
- Node.js开发入门—notepad++ for Node.js
- ES6学习——新的语法:for..of 循环
- Architecture——the main Nodes of configuration for WCF
- ES6入门——Iterator和for...of循环
- 第四周项目3
- c#第一天
- kubernetes之存储学习整理
- Flask源码解读(2) -- context
- 图像金字塔
- JS——for...of...
- Android.mk的用法和基础
- 游戏留言区(六)
- android ANR发生的原因总结和解决办法
- 游戏留言区(七)
- 二分查询
- 游戏留言区(二)
- 游戏留言区(三)
- oracle 涉及行转列、复合查询、函数、 HAVING 、order by、group by、count、case when then、 join