JavaScript Array Nilai Unik
var arr = [55, 44, 65,1,2,3,3,34,5];
var unique = [...new Set(arr)]
//just var unique = new Set(arr) wont be an array
Batman
var arr = [55, 44, 65,1,2,3,3,34,5];
var unique = [...new Set(arr)]
//just var unique = new Set(arr) wont be an array
// usage example:
var myArray = ['a', 1, 'a', 2, '1'];
var unique = myArray.filter((v, i, a) => a.indexOf(v) === i);
// unique is ['a', 1, 2, '1']
const myArray = ['a', 1, 'a', 2, '1'];
const unique = [...new Set(myArray)]; // ['a', 1, 2, '1']
let uniqueItems = [...new Set(items)]
let uniqueItems = [...new Set(items)]
<?php
// app.php
$data = [19, 21, 19, 21, 46, 21, 29, 21, 18];
print_r(array_unique($data));