Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #8595

Javascript property assignment question

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!nx02.iad01.newshosting.com!newshosting.com!69.16.185.21.MISMATCH!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
From karl.lopes@gmail.com
Newsgroups comp.lang.javascript
Subject Javascript property assignment question
Date Wed, 23 Nov 2011 22:06:20 -0800 (PST)
Organization http://groups.google.com
Lines 18
Message-ID <13680863.200.1322114780589.JavaMail.geo-discussion-forums@prfb10> (permalink)
Reply-To comp.lang.javascript@googlegroups.com
NNTP-Posting-Host 207.81.81.112
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
X-Trace posting.google.com 1322114781 2189 127.0.0.1 (24 Nov 2011 06:06:21 GMT)
X-Complaints-To groups-abuse@google.com
NNTP-Posting-Date Thu, 24 Nov 2011 06:06:21 +0000 (UTC)
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=207.81.81.112; posting-account=VQzZ0AoAAAD14LUsaS8tW7Xe6xdU1bHJ
User-Agent G2/1.0
X-Google-Web-Client true
Xref x330-a1.tempe.blueboxinc.net comp.lang.javascript:8595

Show key headers only | View raw


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


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