Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var car = {
model: 'bmw',
color: 'red',
price: 2000
}
Object.defineProperty(car, "type", {
writable: true,
enumerable: true,
configurable: false,
value: 'gas'
});
console.log(car.type); //gas
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment