Path: csiph.com!weretis.net!feeder7.news.weretis.net!news.albasani.net!.POSTED!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: comp.lang.javascript Subject: Re: Object prop missing? Date: Thu, 13 Jun 2019 13:09:35 +0200 Organization: PointedEars Software (PES) Lines: 42 Message-ID: <2720861.OsphAzSTzx@PointedEars.de> References: <12600445.cR47uQ6sgG@PointedEars.de> <4KGdnc1BE6S_tp_AnZ2dnUU7-YXNnZ2d@westnet.com.au> Reply-To: Thomas 'PointedEars' Lahn Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Trace: news.albasani.net 9tGI24VSgFlOIc+OYOquuLW81MOHayzasYZt9O47er12d+0n2ntI/EnxEYfcI1fYRLV/T9dCsqh3Pnk8PgvYemXdQtvCetxX80Zhx2AtyrTp2A8uQ1oo5+1cMsxrW2iK NNTP-Posting-Date: Thu, 13 Jun 2019 11:09:35 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="XTowI86rP7tbNAX6a0SZAzwrIeMYeppCZqABs3WmYMaLU0cA1oa3Sk89NNLSUnBoUjOZF1uSko/yoC2w8QyMY4V77RSwmVVpcm91Uv8Lyt6bZRAd3wZOfYynoBK62w3B"; mail-complaints-to="abuse@albasani.net" User-Agent: KNode/4.14.10 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAGFBMVEXTxa4RFk5dUWANED8PFEfy7+MGBiW+n3ZNF/QuAAACaElEQVQ4jVXUwVOcMBQG8Dc7Rc4PUntdWV2uxjDpGaGeozOp1woar4jd5t/v9wLstMwsA/ntlxdCAgUc1hjTc9/JCZfGoo3wG3HdmdAWrIJRHe7GM/TmpY5VFefuVcAkkPbLIaN8rmPmjloyZxgyR3GuJ4K0AGtJ2htz8o7yqikm759fldQXaMpbDzjKAG+8v+AugVTOPO5DOjLvGtUYQwh0CPjnVMyGd+8/GfUB5nLKJDD2aLDh5HYyMDJGDwQIo2ZmZcKbowNmAdB/AzyFhrmF2MHRb0QJJfaAnwGB6orZhoykLzJtGwF/xpYxI1dswomiUj3gTuAIqCn/4C7cULwGNBtwMTk3Y4LfKB5YUaOKBKYtpplm7u0vip8tU1NWWyI/7XdcSuIDoMt6rVHMWT0DbjHPGqDqZVSa6zleLcUTcIKLoMv3ueJluALtAo9B302zPPlrtiVScRdCjXvVh3e3JpYa/jjkuC9N+LrBMlz/eAN4eQijX2EdLo6c5tGGHwLyHFtXk89dDGHwCVhG9T0S/j55AhRZgkMCmUQXJ49TnS1wnQDvw0eAh9ICeMmEFbCnPMFzjAvsWoEWEFdYEx+S0MoUZ1gT1wId8+AF3Bl2OoEu906AUHx5VLw/gXYg/x84loOah/2UYNrgiwSwGO7RfUzVBbx/kgpckumGOi6QirtD6gkLTitbnxNol47S2jVc2vsN5kPqaAHT8uUdAJM4v/DanjYOwmUjWznGfwB7sGtAtor5BgofDuzaRj4kSQAqDakTsKORa3Q3xKi3gE1fhl71KRMqrdZ2AWNNg/YOhQyrVBnb+i+nEg4bsDA+egAAAABJRU5ErkJggg== X-Face: %i>XG-yXR'\"2P/C_aO%~;2o~?g0pPKmbOw^=NT`tprDEf++D.m7"}HW6.#=U:?2GGctkL,f89@H46O$ASoW&?s}.k+&. On 13/06/2019 8:33 pm, Evertjan. wrote: >> Andrew Poulos 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: | | Twitter: @PointedEars2 | Please do not cc me./Bitte keine Kopien per E-Mail.