Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f500acb

Browse files
update
1 parent dba8fe4 commit f500acb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

‎duplicate.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//How to delete some duplicates from an array
2+
13
const name = ['Munna', 'Munna', 'Rahmat', 'Rabik', 'Rahmat', 'Rakib', 'Emdad', 'Rabik']
24
const duplicate = [];
35
for (let i = 0; i < name.length; i++) {
@@ -6,6 +8,6 @@ for (let i = 0; i < name.length; i++) {
68
if (index === -1) {
79
duplicate.push(element);
810
}
9-
1011
}
11-
console.log(duplicate);
12+
console.log(duplicate);
13+
//expected output: [ 'Munna', 'Rahmat', 'Rabik', 'Rakib', 'Emdad' ]

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /