for…in 循环“for...in”循环用于遍历对象的属性。语法如下:语法for (variablename in object) { statement or block to execute }您可以尝试运行以下示例来实现“for-in”循环。它打印 web 浏览器的 Navigator 对象示例在线演示 var aProperty; document.write("Navigator Object Properties "); for (aProperty in navigator) { document.write(aProperty); document.write(""); } document.write ("Exiting from the loop!"); for…of 循环“for…of”循环用于遍历可迭代对象,包括 Map、Array、arguments 等。语法语法如下:for (variablename of iterable){ statement or block to execute }示例下面是一个显示… 阅读更多