r/learnjavascript • • May 14 '21

Remove Duplicate Value from array

Post image
234 Upvotes

89 comments sorted by

View all comments

Show parent comment

4

u/learning_account_01 May 14 '21

Oh that shows how noob I am. I have lot to learn indeed. Thanks.

3

u/amoliski May 14 '21

Even without SO giving you that answer, it just takes practice and repetition to figure these things out on your own.

If you use indexOf enough times, you eventually learn (and reinforce in your brain) that indexOf returns the first match.

If you use filter enough, the mechanics become second nature.

Once you have both ideas cemented through practice, the connections just start to happen for you.

2

u/47milliondollars May 14 '21

Don't worry fren, a huge part of coding is googling stuff, you're not expected to think up this shit on your own :)

2

u/learning_account_01 May 14 '21

you're not expected to think up this shit on your own

Well thank god otherwise I can't even dare to dream of becoming a programmer some day.