Whisk together the flour, cocoa powder, baking soda, and salt. Set aside.
Using an electric mixer on medium speed, beat the butter, sugar, and brown sugar until light and fluffy. Add the eggs, one at a time, mixing well after each addition. Mix in the vanilla.
Reduce mixer speed to low. Gradually add the flour mixture to the butter mixture, mixing just until combined or a few small streaks of flour remain.
Gently stir in the M&Ms. If you like, save a handful to add to the outside of the rolled cookie dough balls before baking.
Cover and refrigerate the cookie dough for 30 to 60 minutes, or until the dough is cool and easy to handle.
Preheat the oven to 350°F (175°C). Line baking sheets with parchment paper or silicone liners.
Using 2 tablespoons of dough at a time (I use a #30 scoop), roll the dough into balls. Place them on the prepared pans, leaving about 2 inches between each cookie. Add any reserved M&Ms to the outside of the cookies.
Bake (one pan at a time) 8 to 10 minutes, or until the cookies appear set.
Cool the cookies on the pan on a wire rack for 5 to 10 minutes. Then carefully transfer the cookies from the pan directly onto a wire rack to cool completely.
Notes
Store leftovers in an airtight container at room temperature up to 3 days or in the freezer up to 3 months. Place parchment paper or waxed paper between layers.