771
reputation
7
16

VLAZ

Pet peeves:

  • 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 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 this.
    • for, 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.
  • Explanations that say "This works fine" and then proceed to show a problem thus proving it doesn't work "fine".
  • Unformatted code.
1
answer
2
questions
~7k
people reached
  • Member for 4 years, 10 months
  • 17 profile views
  • Last seen Feb 21 at 14:23

Top tags (6)

Score 10
Posts 2
Posts % 67
Score 10
Posts 2
Score 0
Posts 1
Score 0
Posts 1
Score 0
Posts 1
Score 0
Posts 1

Top posts (3) All Questions Answers | Votes Newest

Badges (23)

Gold

Silver

7

Rarest

Bronze

16

Rarest