Here is the Javascript Equivalent to array_unique()

This Javascript function is performs in the same way as the PHP function array_unique($array). The function returns the array with duplicate array items removed leaving each element unique.

// return the array with duplicate items removed just like the php function array_unique()

function array_unique($a) {
    return [...new Set($a)];
}

Example:

<script>
function array_unique($a) {
    return [...new Set($a)];
}

$array = [1,2,3,3,3,6,4,8,3,4,6,5,0,9,0,2,6,03,6,4,7,5,8,6,9,7,0,2,3,10,"hello", "world"];
$array = array_unique($array);
</script>

After the Javascript function call to array_unique($array) the value of $array is:
1,2,3,6,4,8,5,0,9,7,10,hello,world

With other functions:

$array = array_unique($array).sort();

Produces the result:
0,1,10,2,3,4,5,6,7,8,9,hello,world

However this array is mixed with both numeric and string data. The native sort() function places "10" before "2".

If you want a natural sort, use the custom Javascript Equivalent to PHP's natsort():

$array = array_unique(natsort($array));

Produces the result:
0,1,2,3,4,5,6,7,8,9,10,hello,world