for-in for-in循环主要用于遍历对象格式:for(key in obj){...}循环遍历对象自身和继承的可枚举属性(不含Symbol)某些情况下,随机顺续进行循环可以使用break,continue,不可使用return function Person(name, age) { this.name = name; this.age = age; } var person = new Person('张三', 15) Person.prototype.nationality = "English"; for(var i in person) { console.log(i) } test.html:109 name test.html:109 age test.html:109 nationality for-of ES6 引入遍历数据结构的方法支持部署了Symbol.iterator属性的数据结构,如数组、Set 和 Map 结构、某些类似数组的对象(比如arguments对象、DOM NodeList 对象)、Generator 对象,以及字符串可以使用break,continue,不可使用return forEach forEach() 方法用于调用数组的每个元素,并将元素传递给回调函数。arr.forEach(function(value,index){...}forEach()不能使用break和continue语句跳出循环,可以使用return返回,但是效果类似continue -