Stats
22,864
reputation
92k
reached
47
answers
16
questions
Loading…
About
How to help Ukraine
Pet peeves:
- Images posted instead of text.
- Using
.map()
(or any other array iteration method like.filter
, etc), in JavaScript for simply going through the array instead of.forEach()
or a loop`. In general, use the array methods for their purpose:.map
- I have an array, I need another array where each item is based on the first one.flatMap
- like.map
but I use it when each new item also an array.filter
- I have an array, I need less of it.find
- I have an array, I need one item from it.findIndex
- I have an array, I need the index of an item.some
- I have an array, I need to check if at least one item passes a check.every
- I have an array, I need to see if all items pass a check.forEach
- I have an array, I need to do something with each item. Usually I don't want to return anything.reduce
/.reduceRight
- I have an array, I need to make it into "one value". I'll have to check if I really need to use reduce for thisfor
,for..in
,for..of
,while
,do..while
loops if the problem can't (or doesn't need to) fit into one of the above
- Using regular expressions when you need "something with text" instead of parsing, simple string manipulation, or basic arithmetic, and so on.
- Generating DOM content as a string of HTML.
- "Quotes that are not quotes".
- Unformatted code.
Badges
View all badges
2
gold badges
-
ElectorateMay 30, 2021
-
FanaticNov 2, 2020
28
silver badges
-
PunditMar 27, 2019
-
Civic DutyOct 3, 2019
-
EnthusiastOct 23, 2019
48
bronze badges
-
discussionSep 29
-
ExcavatorApr 5
-
OrganizerApr 26, 2020
Top tags
View all tags
830
Score
50
Posts
79
Posts %
290
Score
9
Posts
14
Posts %
165
Score
6
Posts
10
Posts %
165
Score
6
Posts
10
Posts %
145
Score
10
Posts
16
Posts %
99
Score
7
Posts
11
Posts %
Top network posts
View all network posts