Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Ben Bacarisse Newsgroups: comp.lang.javascript Subject: Re: Incremental search in array using index, prevent shotover at end? Date: Tue, 18 Sep 2018 11:41:11 +0100 Organization: A noiseless patient Spider Lines: 13 Message-ID: <87sh2784vs.fsf@bsb.me.uk> References: <056c11c6-1019-4dc7-8d07-b1b950d11f0b@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: reader02.eternal-september.org; posting-host="60e49c2b069d3c2bfefbf22394e753ab"; logging-data="3917"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/+YiBGhALeWcSNOtIliAA3UPvrGmjrxxo=" Cancel-Lock: sha1:RTiRvyoLZv/ezrli1X52O1TlLSU= sha1:b+O9E1wG+/ifAyFl3YXgnEQyyE0= X-BSB-Auth: 1.fb0762e91faf133d79d5.20180918114111BST.87sh2784vs.fsf@bsb.me.uk Xref: csiph.com comp.lang.javascript:35604 Jonas Thörnvall writes: > Would love some "easy search" syntax, maybe there already is? You might consider using Array.prototype.find(): https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find And there is also an Array.prototype.findIndex() method a description of which is linked from the page above. -- Ben.