解决此问题只需在for in循环下增加一个判断,将原型链上的属性过滤掉,具体代码如下: for (i in obj) { if (obj.hasOwnProperty(i)) { console.log(i) } }