Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #36897
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: Object prop missing? |
| Date | 2019-06-13 13:09 +0200 |
| Organization | PointedEars Software (PES) |
| Message-ID | <2720861.OsphAzSTzx@PointedEars.de> (permalink) |
| References | <p6KdnbVLAPPqcZzAnZ2dnUU7-QfNnZ2d@westnet.com.au> <12600445.cR47uQ6sgG@PointedEars.de> <kcidnW32l-lhgp_AnZ2dnUU7-TvNnZ2d@westnet.com.au> <XnsAA6D7FBCFA34eejj99@194.109.6.166> <4KGdnc1BE6S_tp_AnZ2dnUU7-YXNnZ2d@westnet.com.au> |
Andrew Poulos wrote:
> On 13/06/2019 8:33 pm, Evertjan. wrote:
>> Andrew Poulos <ap_prog@hotmail.com> wrote on 13 Jun 2019 in
>> comp.lang.javascript:
>>> On 13/06/2019 5:36 pm, Thomas 'PointedEars' Lahn wrote:
>>>> Andrew Poulos wrote:
>>> var options = [
>>> {},
>>> {"id": "opt1", "on": false },
>>> {"id": "opt2", "on": false },
>>> {"id": "opt3", "on": false },
>>> {"id": "opt4", "on": false },
>>> {"id": "opt5", "on": false }
>>> ];
>>>
>>> for (var i = 6; i > 0; i--) {
>>> // add stuff to options elements
>>> options[i].h = 28;
>>> }
>>>
>>> […]
>>
>> You did not test this, because option[6] does not exist and gives an
>> error.
>
> Yes, you're right the 6 should've been a 5.
Then the same code will not access options[0].
> The code I have is quite long and it gives no value for h even though
> immediately before trying to get the value console.log says it does have
> a value.
If you debug it or try to reduce it to a minimal test case, you will see the
error. Also, ESLint might help.
--
PointedEars
FAQ: <http://PointedEars.de/faq> | <http://PointedEars.de/es-matrix>
<https://github.com/PointedEars> | <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Object prop missing? Andrew Poulos <ap_prog@hotmail.com> - 2019-06-13 16:25 +1000
Re: Object prop missing? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2019-06-13 09:37 +0200
Re: Object prop missing? Andrew Poulos <ap_prog@hotmail.com> - 2019-06-13 20:05 +1000
Re: Object prop missing? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2019-06-13 12:33 +0200
Re: Object prop missing? Andrew Poulos <ap_prog@hotmail.com> - 2019-06-13 20:53 +1000
Re: Object prop missing? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2019-06-13 13:09 +0200
Re: Object prop missing? Andrew Poulos <ap_prog@hotmail.com> - 2019-06-13 21:54 +1000
Re: Object prop missing? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2019-06-13 17:30 +0200
Re: Object prop missing? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2019-06-13 13:05 +0200
Re: Object prop missing? JJ <jj4public@vfemail.net> - 2019-06-13 15:41 +0700
csiph-web