How it works...

The key values defined as literals on the object are enumerable as before. The next two properties are more interesting. The first property, visibleProp, explicitly sets the enumerable attribute to true, and appears in the list. The invisibleProp property is not explicitly set; the default value is false. Only the enumerable properties appear in the iterator.

Get ECMAScript Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.