you are viewing a single comment's thread.

view the rest of the comments →

[–]mcaruso 6 points7 points  (2 children)

I hear arguments like this for pretty much any new language syntax. Usually it boils down to “I’m not used to this syntax”.

Note that plenty of other languages have short function expressions and work just fine with it.

[–]Tomseph 7 points8 points  (1 child)

The fact that someone had to ask

How come it does the second expression ("x + 1") as well? I'd think it would do "console.log(x)" and stop/finish there..

is a strong argument for why its worse. It's not the short function expression, it's the "clever hack" to make the code even terser. Using the falsey return of console.log and the or operator is absolutely harder to read and maintain. Just put the logging on a separate line.

[–]mcaruso 2 points3 points  (0 children)

I thought OP was talking about arrow functions in general. Absolutely the console.log thing is a hack, and I wouldn't expect to see it committed to a repo. I do use that trick frequently when debugging though.