Discuss / JavaScript / Set的forEach参数

Set的forEach参数

Topic source

认识包还

#1 Created at ... [Delete] [Delete and Lock User]

Set的forEach的第二个参数应该是this本身吧

s.forEach(function(e,i,set){
    console.log(e + ' in ' + i);
    console.log(set);
});

 A in A
 Set {"A", "B", "C"}
 B in B
 Set {"A", "B", "C"}
 C in C
 Set {"A", "B", "C"}

应该是的。

Setbu 不是没有索引参数吗?

第二个参数和第一个参数是一样的


  • 1

Reply