function(e){if(Array.isArray(e)&&e.length<=1)return e;let t=Math.floor(e.length/2),r=e[t],i=[],o=[r],a=[];return e.forEach((e,n)=>{e<r?i.push(e):e>r?a.push(e):n!==t&&r===e&&o.push(e)}),[...n(i),...o,...n(a)]}
result
[1,2,3,5,6,6,7,8,14,14,333]
function(e){if(Array.isArray(e)&&e.length<=1)return e;let t=Math.floor(e.length/2),r=e[t],i=[],o=[r],a=[];return e.forEach((e,n)=>{e<r?i.push(e):e>r?a.push(e):n!==t&&r===e&&o.push(e)}),[...n(i),...o,...n(a)]}
[1,2,3,5,6,6,7,8,14,14,333]