遍历对象属性 - Iterate through object properties

问题:

var obj = { name: "Simon", age: "20", clothing: { style: "simple", hipster: false } } for(var propt in obj){ console.log(propt + ': ' + obj[propt]); }

How does the variable propt represent the properties of the object? 变量propt如何表示对象的属性? It's not a built-in method or property. 它不是内置方法或属性。 Why does it come up with every property in the object? 为何它包含对象中的每一个属性? ide


解决方案:

参考一: https://stackoom.com/question/YsRv/遍历对象属性
参考二: https://oldbug.net/q/YsRv/Iterate-through-object-properties
相关文章
相关标签/搜索