Lets say I want to create "colors" collection. The color names inside the collection should be enumerable, while "length" and "currentColor" should not be enumerable:
var colors = { // enumerable properties black: '#000', white: '#fff', blue: '#343', } // non-enumerable properties Object.defineProperty(colors, 'currentColor', { value : 'green', writable : true, enumerable : false, configurable : true}); Object.defineProperty(colors, 'length', { value : 3, writable : true, enumerable : false, configurable : true}); This code works as expected, but it's hard to read because of the verbose descriptor syntax. Is it possible to specify which properties should not be enumerable after they were defined? var colors: { black: '#000', white: '#fff', blue: '#343', currentColor: 'green', length: 3, } makeNonEnumerable(names.currentColor, names.length); -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmentors.com/ To search via a non-Google archive, visit here: http://www.mail-archive.com/jsmentors@googlegroups.com/ To unsubscribe from this group, send email to jsmentors+unsubscr...@googlegroups.com