<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><span class="vcard"><a class="email" href="mailto:benjamin&#64;webkit.org" title="Benjamin Poulain &lt;benjamin&#64;webkit.org&gt;"> <span class="fn">Benjamin Poulain</span></a>
</span> changed
              <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - ECMAScript 2016: %TypedArray%.prototype.includes implementation"
   href="https://bugs.webkit.org/show_bug.cgi?id=159385">bug 159385</a>
        <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">CC</td>
           <td>
               &nbsp;
           </td>
           <td>benjamin&#64;webkit.org
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - ECMAScript 2016: %TypedArray%.prototype.includes implementation"
   href="https://bugs.webkit.org/show_bug.cgi?id=159385#c16">Comment # 16</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - ECMAScript 2016: %TypedArray%.prototype.includes implementation"
   href="https://bugs.webkit.org/show_bug.cgi?id=159385">bug 159385</a>
              from <span class="vcard"><a class="email" href="mailto:benjamin&#64;webkit.org" title="Benjamin Poulain &lt;benjamin&#64;webkit.org&gt;"> <span class="fn">Benjamin Poulain</span></a>
</span></b>
        <pre><span class="quote">&gt; &gt; &gt; Source/JavaScriptCore/runtime/JSGenericTypedArrayViewPrototypeFunctions.h:222
&gt; &gt; &gt; +        if (array[index] == target)
&gt; &gt; 
&gt; &gt; Isn't that missing the NaN case?
&gt; 
&gt; Now I am considering it. However I have a doubt with suspicious cases:
&gt; 
&gt; 1. If the searchElement is an Object or a String? In IntXArray, they are
&gt; converted to 0, so &quot;new UInt8Array([0, 1, 2]).includes(&quot;abc&quot;); // is true&quot;.
&gt; It is not just the case of %TypedArray%.prototype.includes, but also
&gt; %TypedArray%.prototype.indexOf. I didn't find any information about it in
&gt; the Spec. I checked v8 implementation and they return false to these cases.
&gt; IMHO, I think it is the best result, since &quot;new UInt8Array([0, 1,
&gt; 2]).includes(&quot;abc&quot;);&quot; returning &quot;true&quot; is a potential unpredictable bug
&gt; source.</span >

You are right, 
    new UInt8Array([0, 1, 2]).includes(&quot;abc&quot;)
and
    new UInt8Array([0, 1, 2]).indexOf(&quot;abc&quot;)
should return false. Converting the string to a number makes no sense.

The spec does not say to convert the input to a number:
-<a href="https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.indexof">https://tc39.github.io/ecma262/#sec-%typedarray%.prototype.indexof</a>
-<a href="https://tc39.github.io/ecma262/#sec-array.prototype.indexof">https://tc39.github.io/ecma262/#sec-array.prototype.indexof</a>

You have discovered a really stupid bug in the existing indexOf!</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>