Hapus Duplikat Item Form Form Array Menggunakan Metode Redeed ().

const names = [
	'shibu',
	'neymar',
	'vinicius',
	'pattinson',
	'ronaldo',
	'shibu',
	'neymar',
	'pattinson',
	'diCaprio'
];

let onlyName = names.reduce((accumulator, currentValue) => {
	if (accumulator.indexOf(currentValue) === -1) {
		accumulator.push(currentValue);
	}
	return accumulator;
}, []);

console.log(onlyName);

//Expected result => ['shibu', 'neymar', 'vinicius', 'pattinson', 'ronaldo', 'diCaprio'
Shibu Sarkar