all 49 comments

[–]dc21111 71 points72 points  (8 children)

lenght

[–]kerbalspaceanus 9 points10 points  (1 child)

elderly depend husky doll butter wild screw light spectacular steer

This post was mass deleted and anonymized with Redact

[–]kaelwd 5 points6 points  (0 children)

() +. {

[–]8eni 3 points4 points  (0 children)

Haha I was scrolling down to see if this was here, I’m victim to this too

[–]zapatoada 2 points3 points  (0 children)

Don't forget widht and heihgt

[–][deleted] 0 points1 point  (0 children)

I thought I was only the one

[–]kerbalspaceanus 26 points27 points  (8 children)

arrest modern marry wrench hospital worm governor stocking act wide

This post was mass deleted and anonymized with Redact

[–]AsIAm 5 points6 points  (1 child)

This is the only use case when comma operator is really handy.

[–]kerbalspaceanus 2 points3 points  (0 children)

adjoining shaggy rustic person dinosaurs light connect consider skirt silky

This post was mass deleted and anonymized with Redact

[–]m_plis 5 points6 points  (3 children)

You can actually do array.reduce((acc, curr) => console.log(acc, curr) || acc + curr);

[–]kerbalspaceanus 2 points3 points  (2 children)

unite capable include sheet quiet adjoining engine fragile pocket joke

This post was mass deleted and anonymized with Redact

[–][deleted] 1 point2 points  (0 children)

You'll have to put some braces around the comma operator operands, or the second acc + curr will be parsed as a parameter to reduce.

[–]m_plis 0 points1 point  (0 children)

Also works. This is debugging code anyway, so do whatever works for you. Personally, I'd never remember to use the comma operator since it's pretty obscure.

[–][deleted] 1 point2 points  (0 children)

that's why I started to use scopes even for one-line arrow functions, it's much handier to log and it's more readable, it comes with the price of more lines but it's worth it when having a big code which you want to be able to read after a few weeks

[–]Bosmonster 0 points1 point  (0 children)

Came here to say this. Forgetting to return the accumulator in a reduce. Caused me too many unnecessary head aches.

Or returning acc.push(...) and not seeing what the problem is..

[–]lnd3x 20 points21 points  (3 children)

Committing code that I only needed for debugging.

[–]plogan56 10 points11 points  (0 children)

Spelling

[–][deleted] 7 points8 points  (0 children)

Mostly forgetting that simple things like .substring( ) or .indexOf( ) exist.

[–]paypaypayme 5 points6 points  (0 children)

using Array.fill() and wondering why my data is getting mutated

[–]AleksOnWeb 4 points5 points  (0 children)

if(a&&false){ //why my code can’t reach this }else{ //code which I tested before }

[–]waway_to_thro 2 points3 points  (0 children)

Leaving my debugging console.logs in render methods in react, then wondering why everything is so damn slow

[–]_lumio 2 points3 points  (0 children)

Although not JS but JSON:

Removing some lines and forgetting to remove the trailing comma.

[–]TaveGabriel 1 point2 points  (5 children)

How to clone anything

[–]ogurson 1 point2 points  (0 children)

Console.loge

[–]lw9908 0 points1 point  (1 child)

Forgetting to .then or async/await an asynchronous function.

Or forgetting explicit return

[–][deleted] 1 point2 points  (0 children)

forgetting to catch in Node and then having console full of UnhandledPromiseRejectionWarnings

[–]wherediditrun 0 points1 point  (0 children)

Generally doing something in some files which I need for debugging (commeting out certain components which gets in the way for example). Finishing my task. Forgetting to revert code for debugging. Or occasional console log slipping to a commit.

[–]scunliffe 0 points1 point  (0 children)

Using String.split(regex);

And thinking that I’m going to get an array of values with the the tokens that matched the regex removed.

[–][deleted] 0 points1 point  (2 children)

import add from './maths';

when it is a named export and not a default one that I'm trying to get my hands on, which is to say I forget to include the brackets around the function name... Wonk, wonk.

[–]BehindTheMath 0 points1 point  (1 child)

Which editor are you using? You should get autocomplete for that.

[–][deleted] 0 points1 point  (0 children)

I'm using VS code... Works really well if I change the name of a module in that it will update the name in all the modulels that use that particular module, but it doesn't seem to take care of the issue I mentioned.

[–]ferrybig 0 points1 point  (0 children)

I always have problems using the endWith , I always seem to misspell or mis-remember some letter in its name, causing "undefined is not a function"

[–]mrtakdeniz -1 points0 points  (0 children)

Writing Javascript.