<div dir="ltr">I believe every array iteration method that takes a callback, except for reduce and reduceRight, take an optional receiver as the last argument (the `this` value), so they can't be meaningfully/ergonomically extended.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Aug 15, 2019 at 3:00 PM Andrea Giammarchi <<a href="mailto:andrea.giammarchi@gmail.com">andrea.giammarchi@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>isn't the second argument already reserved for the context?</div><div><br></div><div>```js</div><div><span class="gmail-m_6140662353656227697gmail-message-body-wrapper"><span class="gmail-m_6140662353656227697gmail-message-flex-body"><span class="gmail-m_6140662353656227697gmail-message-body gmail-m_6140662353656227697gmail-devtools-monospace">[<span class="gmail-m_6140662353656227697gmail-cm-number">1</span>, <span class="gmail-m_6140662353656227697gmail-cm-number">2</span>, <span class="gmail-m_6140662353656227697gmail-cm-number">3</span>].<span class="gmail-m_6140662353656227697gmail-cm-property">findIndex</span>(<span class="gmail-m_6140662353656227697gmail-cm-keyword">function</span> (<span class="gmail-m_6140662353656227697gmail-cm-def">i</span>) { <span class="gmail-m_6140662353656227697gmail-cm-keyword">return</span> <span class="gmail-m_6140662353656227697gmail-cm-variable-2">i</span> <span class="gmail-m_6140662353656227697gmail-cm-operator">==</span> <span class="gmail-m_6140662353656227697gmail-cm-keyword">this</span>; }, <span class="gmail-m_6140662353656227697gmail-cm-number">2</span>);</span></span></span></div><div><span class="gmail-m_6140662353656227697gmail-message-body-wrapper"><span class="gmail-m_6140662353656227697gmail-message-flex-body"><span class="gmail-m_6140662353656227697gmail-message-body gmail-m_6140662353656227697gmail-devtools-monospace">// 1<br></span></span></span></div><div><span class="gmail-m_6140662353656227697gmail-message-body-wrapper"><span class="gmail-m_6140662353656227697gmail-message-flex-body"><span class="gmail-m_6140662353656227697gmail-message-body gmail-m_6140662353656227697gmail-devtools-monospace">```<br></span></span></span></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Aug 15, 2019 at 11:51 PM Cyril Auburtin <<a href="mailto:cyril.auburtin@gmail.com" target="_blank">cyril.auburtin@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr">It should be possible to add a second optional argument to the `find` and `findIndex` array methods, similarly to `indexOf`</div>
_______________________________________________<br>
es-discuss mailing list<br>
<a href="mailto:es-discuss@mozilla.org" target="_blank">es-discuss@mozilla.org</a><br>
<a href="https://mail.mozilla.org/listinfo/es-discuss" rel="noreferrer" target="_blank">https://mail.mozilla.org/listinfo/es-discuss</a><br>
</blockquote></div>
_______________________________________________<br>
es-discuss mailing list<br>
<a href="mailto:es-discuss@mozilla.org" target="_blank">es-discuss@mozilla.org</a><br>
<a href="https://mail.mozilla.org/listinfo/es-discuss" rel="noreferrer" target="_blank">https://mail.mozilla.org/listinfo/es-discuss</a><br>
</blockquote></div>