相关疑难解决方法(0)

for...of loop. Should I use const or let?

When using a for of loop, both of these are allowed and work:

const numbers = [1,2,3];
// works
for(let number of numbers) {
    console.log(number);
}
// also works
for(const number of numbers) {
    console.log(number);
}
Run Code Online (Sandbox Code Playgroud)

I always use const since I annot fanthom changing the number variable in any context, but when I see a for...of loop in other people's code, it often uses let. Maybe there's a drawback to const that I didn't see? Browser bugs?

为什么在循环中使用 …

javascript ecmascript-6 for-of-loop

26
推荐指数
2
解决办法
1万
查看次数

WebRTC:确定PeerConnection中使用的TURN服务器

场景:您想知道是否正在使用TURN服务器进行特定呼叫,以及是否正在使用您在创建PeerConnection期间提供的TURN服务器阵列中的哪一个.现在有两种选择:

  • Wireshark:但是当你在公司代理服务器后面并且TURN服务器在那之外时,wireshark会将代理IP显示为目的地.(也没有提到在后台运行它的不便)
  • 浏览统计页面并查找,chrome - > chrome:// webrtc-internals和Firefox - > about:webrtc

我想使用上面两个的替代方法,以编程方式确定这一点,所以我不必离开我的应用程序页面.

javascript webrtc turn

7
推荐指数
1
解决办法
3144
查看次数

标签 统计

javascript ×2

ecmascript-6 ×1

for-of-loop ×1

turn ×1

webrtc ×1