Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #8595
| From | karl.lopes@gmail.com |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Javascript property assignment question |
| Date | 2011-11-23 22:06 -0800 |
| Organization | http://groups.google.com |
| Message-ID | <13680863.200.1322114780589.JavaMail.geo-discussion-forums@prfb10> (permalink) |
Hi,
I am trying to understand assignment in javascript. Assume ECMAScript 5.
My Question is why does step 4 in the note below work. I would expect it to fail.
1. //Create an Object...
var buffer = Object.create(Object.prototype);
2. //Add a property
Object.defineProperty(buffer, "__data__", {value:[],writable:false,enumerable:false,configurable:false});
Note in setp 2 the property is completely closed to any modification.
In particular...
3.var buffer_copy = Object.create(buffer);
//I would expect the line below to fail.. Since in Step 2 __data__ is made //writable false. BUT It works and the assignment does take place.
//As per JavaScript the Definitive Guide pg 122: If o inherits a read-only //property named x, for example, then the assignment is not allowed.
4.buffer_copy.__data__ = [];
Back to comp.lang.javascript | Previous | Next — Next in thread | Find similar | Unroll thread
Javascript property assignment question karl.lopes@gmail.com - 2011-11-23 22:06 -0800 Re: Javascript property assignment question Richard Cornford <Richard@litotes.demon.co.uk> - 2011-11-24 04:10 -0800
csiph-web