UNPKG
remove-array-duplicates
Version:
latest (1.0.4)
1.0.4
Remove Duplicates from array
remove-array-duplicates
/
index.js
14 lines
(11 loc)
•
276 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
var
duplicate_values
=
[
'pen'
,
'book'
,
'pencil'
,
'book'
,
'pencil'
];
var
new_array=[]; function
duplicateArray
(arr)
{
for
(
var
i=
0
;i<arr.length;i++){
if
(arr.indexOf(arr[i])==i){ new_array.push(arr[i]) } }
return
new_array; }
module
.
exports
= duplicateArray;