Pranay Kothapalli’s Reviews > Eloquent JavaScript: A Modern Introduction to Programming > Status Update
Pranay Kothapalli
is on page 125 of 224
It is possible to define our own nonenumerable properties by using the Object.defineProperty function, which allows us to control the type of property we are creating.
Object.defineProperty(Object.prototype , "hiddenNonsense", {enumerable: false, value: "hi"}); for (var name in map) console.log(name); // → pizza // → touched tree console.log(map.hiddenNonsense); // → hi
— Nov 26, 2016 02:20AM
Object.defineProperty(Object.prototype , "hiddenNonsense", {enumerable: false, value: "hi"}); for (var name in map) console.log(name); // → pizza // → touched tree console.log(map.hiddenNonsense); // → hi
Like flag

