<p dir="auto">It seems that <code class="notranslate">String.prototype.localeCompare</code> does not correctly take into account the <code class="notranslate">numeric</code> option when sorting.</p>
<p dir="auto">Example snippet:</p>
<div class="highlight highlight-source-ts notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="const items = ['1', '2', '1a', '10b', '10a', '10'];
const sortedItems = items.sort((a, b) =&gt; a.localeCompare(b, 'en', {numeric: true}));
console.log(sortedItems);"><pre class="notranslate"><span class="pl-k">const</span> <span class="pl-s1">items</span> <span class="pl-c1">=</span> <span class="pl-kos">[</span><span class="pl-s">'1'</span><span class="pl-kos">,</span> <span class="pl-s">'2'</span><span class="pl-kos">,</span> <span class="pl-s">'1a'</span><span class="pl-kos">,</span> <span class="pl-s">'10b'</span><span class="pl-kos">,</span> <span class="pl-s">'10a'</span><span class="pl-kos">,</span> <span class="pl-s">'10'</span><span class="pl-kos">]</span><span class="pl-kos">;</span>
<span class="pl-k">const</span> <span class="pl-s1">sortedItems</span> <span class="pl-c1">=</span> <span class="pl-s1">items</span><span class="pl-kos">.</span><span class="pl-en">sort</span><span class="pl-kos">(</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'</span><span class="pl-kos">,</span> <span class="pl-kos">{</span><span class="pl-c1">numeric</span>: <span class="pl-c1">true</span><span class="pl-kos">}</span><span class="pl-kos">)</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">sortedItems</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">Node and the browser log out <code class="notranslate">[ '1', '1a', '2', '10', '10a', '10b' ]</code>.<br>
Whereas Deno logs out <code class="notranslate">[ "1", "10", "10a", "10b", "1a", "2" ]</code>.</p>
<p dir="auto"><a href="https://repl.it/join/frelbyvt-iamtrs" rel="nofollow">Deno Repl</a><br>
<a href="https://repl.it/join/xpmnqpex-iamtrs" rel="nofollow">Node Repl</a></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>