Explain, please, what are enumerable and non-enumerable properties? Faced them here:
The
propertyIsEnumerable()method imposes additional restrictions compared tohasOwnProperty(). It returnstrueonly if the specified property is a property of its own, whoseenumerableattribute istrue. Properties of embedded objects are not enumerated. Properties created by a regular JavaScript program are enumerated if one of the ECMAScript 5 methods presented below, which make the properties non-enumerable, was not used.var o = inherit({ y: 2 }); ox = 1; o.propertyIsEnumerable("x"); // true: o имеет собств. перечислимое свойство x o.propertyIsEnumerable("y"); // false: y - унаследованное свойство, не собств. Object.prototype.propertyIsEnumerable("toString"); // false: неперечислимое(c) David Flanagan "JavaScript. Detailed Guide", 6th edition, p. 148
From these lines it turns out that:
- Non-enumerable properties are properties of embedded objects. Here you should clarify what are embedded objects: these are
Array,Boolean,Date,Error,Function,Global,JSON,Math,Number,Object,RegExpandStringobjects. Enumerated properties are properties created by a regular program. It is from this context that the properties assigned to the object by the assignment operator
=, without any inheritance (own properties):ox = 1 // Объекту "o" присвоенно свойство "x" со значеним "1"those. non-enumerable property will be in the case of inheritance, and if it is a property of an embedded object.
While writing, as if figured out. Correct me if I am mistaken.