<p dir="auto"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare" rel="nofollow"><code class="notranslate">String.prototype.localeCompare()</code> on MDN</a></p>
<p dir="auto">I noticed that some results differ significantly from Chrome in test cases when using this method. I'm not sure if/how this is standardized or where the responsibility lies, but I wanted to surface this because it seems like a bug.</p>
<p dir="auto">Here's an example you can copy+paste to run in a browser console or Deno REPL:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="(() =&gt; {
  const pairs = [
    ['a', 'á'],
    ['á', 'a'],
    ['a', 'b'],
    ['b', 'a'],
    ['á', 'b'],
    ['b', 'á'],
  ];

  const compare = (a, b) =&gt; a.localeCompare(b, 'en-US', {sensitivity: 'base'});
  const results = pairs
    .map(pair =&gt; [...pair, compare(...pair)].join(' '))
    .join('\n');
  console.log(results);
})();"><pre class="notranslate"><span class="pl-kos">(</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
  <span class="pl-k">const</span> <span class="pl-s1">pairs</span> <span class="pl-c1">=</span> <span class="pl-kos">[</span>
    <span class="pl-kos">[</span><span class="pl-s">'a'</span><span class="pl-kos">,</span> <span class="pl-s">'á'</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
    <span class="pl-kos">[</span><span class="pl-s">'á'</span><span class="pl-kos">,</span> <span class="pl-s">'a'</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
    <span class="pl-kos">[</span><span class="pl-s">'a'</span><span class="pl-kos">,</span> <span class="pl-s">'b'</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
    <span class="pl-kos">[</span><span class="pl-s">'b'</span><span class="pl-kos">,</span> <span class="pl-s">'a'</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
    <span class="pl-kos">[</span><span class="pl-s">'á'</span><span class="pl-kos">,</span> <span class="pl-s">'b'</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
    <span class="pl-kos">[</span><span class="pl-s">'b'</span><span class="pl-kos">,</span> <span class="pl-s">'á'</span><span class="pl-kos">]</span><span class="pl-kos">,</span>
  <span class="pl-kos">]</span><span class="pl-kos">;</span>

  <span class="pl-k">const</span> <span class="pl-en">compare</span> <span class="pl-c1">=</span> <span class="pl-kos">(</span><span class="pl-s1">a</span><span class="pl-kos">,</span> <span class="pl-s1">b</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-s1">a</span><span class="pl-kos">.</span><span class="pl-en">localeCompare</span><span class="pl-kos">(</span><span class="pl-s1">b</span><span class="pl-kos">,</span> <span class="pl-s">'en-US'</span><span class="pl-kos">,</span> <span class="pl-kos">{</span><span class="pl-c1">sensitivity</span>: <span class="pl-s">'base'</span><span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-k">const</span> <span class="pl-s1">results</span> <span class="pl-c1">=</span> <span class="pl-s1">pairs</span>
    <span class="pl-kos">.</span><span class="pl-en">map</span><span class="pl-kos">(</span><span class="pl-s1">pair</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">[</span>...<span class="pl-s1">pair</span><span class="pl-kos">,</span> <span class="pl-en">compare</span><span class="pl-kos">(</span>...<span class="pl-s1">pair</span><span class="pl-kos">)</span><span class="pl-kos">]</span><span class="pl-kos">.</span><span class="pl-en">join</span><span class="pl-kos">(</span><span class="pl-s">' '</span><span class="pl-kos">)</span><span class="pl-kos">)</span>
    <span class="pl-kos">.</span><span class="pl-en">join</span><span class="pl-kos">(</span><span class="pl-s">'\n'</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">results</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<table role="table">
<thead>
<tr>
<th>a</th>
<th>b</th>
<th align="right">Chrome</th>
<th align="right">Deno</th>
</tr>
</thead>
<tbody>
<tr>
<td>a</td>
<td>á</td>
<td align="right">0</td>
<td align="right">-128</td>
</tr>
<tr>
<td>á</td>
<td>a</td>
<td align="right">0</td>
<td align="right">128</td>
</tr>
<tr>
<td>a</td>
<td>b</td>
<td align="right">-1</td>
<td align="right">-1</td>
</tr>
<tr>
<td>b</td>
<td>a</td>
<td align="right">1</td>
<td align="right">1</td>
</tr>
<tr>
<td>á</td>
<td>b</td>
<td align="right">-1</td>
<td align="right">127</td>
</tr>
<tr>
<td>b</td>
<td>á</td>
<td align="right">1</td>
<td align="right">-127</td>
</tr>
</tbody>
</table>
<p dir="auto">Chrome <code class="notranslate">83.0.4103.97</code><br>
Deno <code class="notranslate">1.1.0</code></p>
<p dir="auto">Specifically, note <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Collator/Collator#:~:text=Only%20strings%20that%20differ%20in%20base%20letters%20compare%20as%20unequal" rel="nofollow">the description</a> for using the value "base" for the "sensitivity" option:</p>
<blockquote>
<p dir="auto">Only strings that differ in base letters compare as unequal. Examples: <code class="notranslate">a ≠ b</code>, <code class="notranslate">a = á</code>, <code class="notranslate">a = A</code></p>
</blockquote>
<p dir="auto">In the example above for <code class="notranslate">a</code> and <code class="notranslate">á</code>, Chrome returns <code class="notranslate">0</code> (equal), but Deno does not.</p>
<p dir="auto">As seen in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="422116599" data-permission-text="Title is private" data-url="https://github.com/denoland/deno/issues/1952" data-hovercard-type="issue" data-hovercard-url="/denoland/deno/issues/1952/hovercard" href="https://github.com/denoland/deno/issues/1952">#1952</a> / <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="405562913" data-permission-text="Title is private" data-url="https://github.com/denoland/deno/issues/1636" data-hovercard-type="issue" data-hovercard-url="/denoland/deno/issues/1636/hovercard" href="https://github.com/denoland/deno/issues/1636">#1636</a> ICU needs to be added in Deno build.</p>
<p dir="auto">Switching this flag to true maybe: <a href="https://github.com/denoland/deno/blob/master/.gn#L50">https://github.com/denoland/deno/blob/master/.gn#L50</a> ?</p>
<p dir="auto">ref: <a href="https://v8.dev/docs/i18n" rel="nofollow">https://v8.dev/docs/i18n</a></p>