Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #38392
| Path | csiph.com!news.mixmin.net!news.albasani.net!.POSTED!not-for-mail |
|---|---|
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
| Newsgroups | comp.lang.javascript |
| Subject | Re: check for obj nested prop |
| Date | Sat, 09 May 2020 00:26:07 +0200 |
| Organization | PointedEars Software (PES) |
| Lines | 26 |
| Message-ID | <11518358.O9o76ZdvQC@PointedEars.de> (permalink) |
| References | <C9udnTlJHfCQbSnDnZ2dnUU7-U3NnZ2d@westnet.com.au> <87pnbeycrm.fsf@bsb.me.uk> |
| Reply-To | Thomas 'PointedEars' Lahn <cljs@PointedEars.de> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="UTF-8" |
| Content-Transfer-Encoding | 8Bit |
| X-Trace | news.albasani.net ORtAhkf61bbpe04VESmhVUi9aqKAWFwegEwTA01x1zpHC5PMv3JLigGjDhvMgagHTkyo9pwhj9ggro0gEU/flusP0yh7UDqcgXddbW1LBrd7P8p+s5N1JZkgnPgfiMUN |
| NNTP-Posting-Date | Fri, 8 May 2020 22:26:08 +0000 (UTC) |
| Injection-Info | news.albasani.net; logging-data="eWi+//BMNGQu3BUaGGtYHuA1gULcTQekmssEzhW5gV1xnD6LWicXqBZVangXnYK1X8fL0givpoPjApF+nHjieqDc1fPZFBcSFxuZTUDJY9C+Dw2SlXW/QDGBB3tm6GrA"; 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+&.<b';Md8`dH6iqhT)6C^.Px|[=M@7=Ik[_w<%n1Up"LPQNu2m8|L!/3iby{-]A+#YE}Kl{Cw$\U!kD%K}\2jz"QQP6Uqr],./"?;=4v |
| Cancel-Lock | sha1:PHsmD0AN23NSmPrM69Oznob19YQ= |
| Xref | csiph.com comp.lang.javascript:38392 |
Show key headers only | View raw
Ben Bacarisse wrote:
> Andrew Poulos <ap_prog@hotmail.com> writes:
>> so I end up doing
>>
>> if (a && a.b && a.b.c && a.b.c.d)
> <cut>
>> Is there a way to get the check value of an object's nested property
>> without first having to test for all the ascendant properties?
>
> if (try {obj.a.b.c.d} catch {})
>
> might do what you want.
This is *obviously* syntactically invalid; “try {obj.a.b.c.d} catch {}” is
not an /Assignment*Expression*/, but a /Try*Statement*/. If you do not want
to learn the grammar of the languages, please at least do minimal testing
before you post suggestions.
<http://ecma-international.org/ecma-262/#prod-IfStatement>
--
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
check for obj nested prop Andrew Poulos <ap_prog@hotmail.com> - 2020-05-08 15:37 +1000
Re: check for obj nested prop Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-05-08 10:52 +0100
Re: check for obj nested prop Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2020-05-09 00:26 +0200
Re: check for obj nested prop Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-05-09 03:09 +0100
Re: check for obj nested prop Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2020-05-12 09:28 +0200
Re: check for obj nested prop Julio Di Egidio <julio@diegidio.name> - 2020-05-12 04:01 -0700
Exception handling (was: check for obj nested prop) Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2020-05-09 03:46 +0200
Re: check for obj nested prop JJ <jj4public@vfemail.net> - 2020-05-08 17:18 +0700
Re: check for obj nested prop Julio Di Egidio <julio@diegidio.name> - 2020-05-08 03:53 -0700
Re: check for obj nested prop James Kirk <noneya.invalid@gmail.com> - 2020-05-08 11:00 -0400
Re: check for obj nested prop Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2020-05-09 00:19 +0200
Re: check for obj nested prop Julio Di Egidio <julio@diegidio.name> - 2020-05-12 04:04 -0700
Re: check for obj nested prop luserdroog <luser.droog@gmail.com> - 2020-05-12 07:59 -0700
Re: check for obj nested prop "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-05-12 14:17 -0700
Re: check for obj nested prop Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2020-05-13 02:46 +0200
Re: check for obj nested prop Andrew Poulos <ap_prog@hotmail.com> - 2020-05-13 13:08 +1000
Re: check for obj nested prop "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-05-13 12:30 -0700
csiph-web