for in 详解
for in 是 JavaScript 1.0 版本中就有的语法,本文将对 for in 进行详细介绍
1. for in 循环所遍历的范围
for in 循环遍历一个对象的可枚举属性,包括这个对象继承自原型链上的可枚举属性
举个例子:
Object.prototype.objCustom = function() {};
Array.prototype.arrCustom = function() {};
const iterable = [3, 5, 7];
iterable.foo = 'hello
翻译
2020-12-21 10:58:37 ·
27323 阅读 ·
0 评论