Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #14388
| Message-ID | <1600385.oMNUckLgyt@PointedEars.de> (permalink) |
|---|---|
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
| Organization | PointedEars Software (PES) |
| Date | 2012-06-08 09:48 +0200 |
| Subject | Re: Array.prototype.splice implementation in 'JS: The Good Parts' |
| Newsgroups | comp.lang.javascript |
| References | <921eeaac-96e3-440b-b023-20bd8a37f049@d17g2000vbv.googlegroups.com> <9708336.O9o76ZdvQC@PointedEars.de> <63269589-d3ec-42f9-b4eb-9fa98ddef243@p13g2000yqk.googlegroups.com> |
| Followup-To | comp.lang.javascript |
Followups directed to: comp.lang.javascript
Jun Woong wrote: > Thomas 'PointedEars' Lahn <PointedE...@web.de> wrote: >> Jun Woong wrote: >> > What does the ECMA standard says about this? >> >> <http://ecma-international.org/ecma-262/5.1/#sec-15.4.4>: >> >> [...] >> | b. Let fromPresent be the result of calling the [[HasProperty]] >> | internal method of O with argument from. >> >> var fromPresent = from in O; >> >> This is the step in the algorithm where apparently both Crockford and V8 >> are wrong, according to the 5.1 Edition and earlier Editions. Crockford >> does not consider `undefined' values for elements, and V8 does not >> consider uninitialized elements (here: those with indexes 0 and 1). > > Thus, if `a' is intialized as [undefined, undefined, 0] (having all > elements initialized), the length of the result should be 2, while it > should be 0 when initialized as [,, 0] (having uninitialized > elements). Yes, exactly. (That var a = [,, 0]; is equivalent to var a = []; a[2] = 0; follows from section "11.1.4 Array Initialiser".) > Thank you very much for the kind explanation and the nice work that > the link below leads to. > >> ___ >> [1] <http://PointedEars.de/es-matrix> You are welcome. (Stay tuned.) Regards, PointedEars -- Use any version of Microsoft Frontpage to create your site. (This won't prevent people from viewing your source, but no one will want to steal it.) -- from <http://www.vortex-webdesign.com/help/hidesource.htm> (404-comp.)
Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread
Array.splice implementation in 'JS: The Good Parts' Jun Woong <woong@icu.ac.kr> - 2012-06-06 21:17 -0700
Array.prototype.splice implementation in 'JS: The Good Parts' (was: Array.splice implementation in 'JS: The Good Parts') Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-06-07 20:17 +0200
Re: Array.prototype.splice implementation in 'JS: The Good Parts' (was: Array.splice implementation in 'JS: The Good Parts') Jun Woong <woong@icu.ac.kr> - 2012-06-07 18:41 -0700
Re: Array.prototype.splice implementation in 'JS: The Good Parts' Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-06-08 09:48 +0200
csiph-web