You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
programming-examples/js/Array/Write a JavaScript program ...

16 lines
354 B
JavaScript

function find_duplicate_in_array(arra1) {
var i,
len=arra1.length,
result = [],
obj = {};
for (i=0; i<len; i++)
{
obj[arra1[i]]=0;
}
for (i in obj) {
result.push(i);
}
return result;
}
var arr = [1, 2, -2, 4, 5, 4, 7, 8, 7, 7, 71, 3, 6];
console.log(find_duplicate_in_array(arr));