var a = ['A', 'B', 'C'];
var s = new Set(['A', 'B', 'C']);
var m = new Map([[1, 'x'], [2, 'y'], [3, 'z']]);
for (var x of a) { // 遍历Array
alert(x);//'A', 'B', 'C'
}
for (var x of s) { // 遍历Set
alert(x);//'A', 'B', 'C'
}
for (var x of m) { // 遍历Map
alert(x[0] + '=' + x[1]);//1='x',2='y',3='z'
}

比如通过for...of...对数组中与三俗出现次数进行统计

let string = 'kapilalipak';

const table={};
for(let char of string) {
table[char]=table[char]+1 || 1;
}
// 输出
{k: 2, a: 3, p: 2, i: 2, l: 2}