Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #38195
| Newsgroups | comp.lang.javascript |
|---|---|
| Date | 2020-02-24 02:02 -0800 |
| References | <i_adnaLrBajpv87DnZ2dnUU7-KfNnZ2d@westnet.com.au> <o8adnRKpOaYkoM7DnZ2dnUU7-XnNnZ2d@westnet.com.au> |
| Message-ID | <2c43df71-caf3-4375-b2ed-6e9c474e23f3@googlegroups.com> (permalink) |
| Subject | Re: Search array of objects |
| From | Julio Di Egidio <julio@diegidio.name> |
On Monday, 24 February 2020 04:06:42 UTC+1, Andrew Poulos wrote:
> slides.forEach(s => {
> s.forEach(item => {
> if (item.type == 'text' && item.hasOwnProperty('content')) {
> item.disabled = !chk; // a value set earlier
> }
> };
> });
>
> and it seems to work. Is this a good approach?
It depends: how static is the data and how fixed is the search criteria?
If they are (static and fixed: or, to the extent that they are), do a
first pass at startup time to find those objects once and for all. If
they are not (or, to the extent that they are not), you are indeed stuck
with exhaustive search...
Julio
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Search array of objects Andrew Poulos <ap_prog@hotmail.com> - 2020-02-24 12:10 +1100
Re: Search array of objects Andrew Poulos <ap_prog@hotmail.com> - 2020-02-24 14:06 +1100
Re: Search array of objects luserdroog <luser.droog@gmail.com> - 2020-02-23 21:33 -0800
Re: Search array of objects Julio Di Egidio <julio@diegidio.name> - 2020-02-24 02:02 -0800
Re: Search array of objects Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2020-02-24 12:23 +0100
Re: Search array of objects John G Harris <niam@jghnorth.org.uk.invalid> - 2020-02-24 18:31 +0000
Re: Search array of objects Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2020-02-25 09:24 +0100
Re: Search array of objects John G Harris <niam@jghnorth.org.uk.invalid> - 2020-02-25 11:40 +0000
Re: Search array of objects Julio Di Egidio <julio@diegidio.name> - 2020-02-25 03:57 -0800
Re: Search array of objects Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2020-02-25 19:02 +0100
Re: Search array of objects John G Harris <niam@jghnorth.org.uk.invalid> - 2020-02-25 19:18 +0000
Re: Search array of objects Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2020-02-25 21:51 +0100
Re: Search array of objects John G Harris <niam@jghnorth.org.uk.invalid> - 2020-02-26 16:09 +0000
Re: Search array of objects Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2020-02-25 19:09 +0100
Re: Search array of objects "Mark-" <nospam@mapson.xyz> - 2020-02-25 19:18 +0000
Re: Search array of objects Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2020-02-25 21:58 +0100
Re: Search array of objects John G Harris <niam@jghnorth.org.uk.invalid> - 2020-02-26 16:09 +0000
Re: Search array of objects John G Harris <niam@jghnorth.org.uk.invalid> - 2020-02-25 19:47 +0000
csiph-web