2
u/devbrk May 14 '21
So how really does it work? I mean I assume that we can’t use it in an interview.
2
u/suprabha-supi May 14 '21
What I have seen, interviews always ask multiple ways.
In those we have different ways:
Using Set
Array.from
filter
reduce
forEach
1
u/suprabha-supi May 14 '21
I have added few ways which we can use to remove duplicate values from an array:
3
u/Budget_Instruction49 May 14 '21
'Set ' a state ? or its just set ?
5
u/turningsteel May 14 '21
Set is a datatype. Just Set: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set
2
u/slowthedataleak May 14 '21
Not sure that I understand your question but what's happening here is the array is being duplicated into a Set type.
5
May 14 '21
Not sure that I understand your question
probably brain poisoned by trying to learn React and JS at the same time.
4
u/StoneCypher May 14 '21
He's asking whether the word "set" is being used to mean
assignor whether it's being used to refer to the container typeHe's from India, and English isn't his first language. Homophones can be confusing
2
2
u/Budget_Instruction49 May 15 '21
oh. are you a hacker ? or reddit shows my location ? or you read my comments ? i am scared
2
u/StoneCypher May 15 '21
What? You said so
You're scared because someone read your comments? ಠ_ಠ
2
u/Budget_Instruction49 May 15 '21
chill mate. "i am scared" is a famous meme. i was joking. maybe visit r/memes too
2
u/StoneCypher May 15 '21
"i am scared" is a famous meme.
your delivery is not great
2
u/Budget_Instruction49 May 15 '21
wait a minute ... who are you ?
1
u/StoneCypher May 15 '21
the bored guy who is going to stop responding because these are not:
memes
funny
2
3
May 15 '21
Everyone arguing in the comments about performance and I'm just here like "damn this presentation is obnoxious".
Seriously - array of emojis, super bright background colors, obnoxious self-promotion. Jesus.
Regardless of the performance or accuracy, this is just gross.
1
u/Parkreiner May 15 '21
I mean, I think emojis can be fun, and bold colors are fine (though the blue-yellow gradient is really ugly and doesn't have enough color stops), but yeah, the image was clearly made more for self-promotion than to be informative. The first thing that's going to draw your attention is the green circle right in the middle of the image, rather than the code itself.
2
u/godsknowledge May 14 '21
I had to use that at work recently. Fetched data from a list in SharePoint and put them into an array. Since they array contained duplicates, I only had to create a Map to get rid of the duplicates.
Parsed it into JSON and voila, you can easily integrate it into other applications like Nintex Forms.
1
1
20
u/slowthedataleak May 14 '21
Does this perform better than filter()?