
本文共 1765 字,大约阅读时间需要 5 分钟。
JS���������������������������������������������������������������������������
1. ������for������
������������������������������������������������������
for(j=0; j
������������������������������������
2. ���������for������
���������������������������������������������������������������
for(j=0, len=arr.length; j
���������������������������for���������
3. ���������for������
���������������������������������������������������������null���������
for(j=0; arr[j]!=null; j++) { //������}
������������������������������������������������������������������������
4. forEach������
������������������������������������
arr.forEach(function(e) { //������});
���������������������������������������������
5. forEach������
������������������������
Array.prototype.forEach.call(arr, function(el) { //������});
���������������������������������������������������������forEach���
6. for...in������
������������������������������������������
for(j in arr) { //������}
������������������������������������������������
7. for...of������
ES6���������������������������������������������for...in���
for(let value of arr) { //������}
���������������������������������������
8. map������
���������������������������������
arr.map(function(n) { //������});
���������������������������������������������������������������������������
������������������
- ������for������������������������������������������
- ���������for���������������������������������������������
- forEach���������������������������������������������
- for...in������������������������������
- for...of���������������for...in������������������������������
- map������������������������������������������
���������������������������������������������������������������������������������������������
发表评论
最新留言
关于作者
