MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/learnjavascript/comments/nc6i5j/remove_duplicate_value_from_array/gy71so0/?context=3
r/learnjavascript • u/suprabha-supi • May 14 '21
89 comments sorted by
View all comments
Show parent comments
10
arr.filter((el, index) => arr.indexOf(el) === index);
Works too!
(but worth saying that shorthand isn't always the most readable and shouldn't be your default approach!)
2 u/StoneCypher May 14 '21 is there any difference there other than switching to an arrow? 0 u/[deleted] May 14 '21 [deleted] 1 u/grooomps May 15 '21 So a function without a fat arrow doesn't have explicit return?
2
is there any difference there other than switching to an arrow?
0 u/[deleted] May 14 '21 [deleted] 1 u/grooomps May 15 '21 So a function without a fat arrow doesn't have explicit return?
0
[deleted]
1 u/grooomps May 15 '21 So a function without a fat arrow doesn't have explicit return?
1
So a function without a fat arrow doesn't have explicit return?
10
u/[deleted] May 14 '21 edited May 14 '21
Works too!
(but worth saying that shorthand isn't always the most readable and shouldn't be your default approach!)