1var person = {name: 'bob', age: 30}
2
3// This sets the name to be read only
4Object.defineProperty( person, 'name', {
5 value: "bob",
6 writable: false,
7});
8
9// This sets the age to be writable
10Object.defineProperty( person, 'name', {
11 value: "age",
12 writable: true,
13});
14
15person.name = 'tim' // this will NOT work
16peron.age = 40 // this will work