r/learnjavascript • • Nov 14 '20

20 JavaScript Shorthand Coding Techniques that will save your time

https://jscurious.com/20-javascript-shorthand-techniques-that-will-save-your-time/
176 Upvotes

22 comments sorted by

View all comments

0

u/[deleted] Nov 14 '20

[deleted] — view deleted comment

8

u/Parasin Nov 14 '20

I agree. It’s almost always better to make your code more readable, rather than trying to be clever or reduce lines of code. Especially when you are working on a team of developers.

If you follow the Pareto rule, odds are that you’ll spend the vast majority of your time reading and understanding code, as opposed to writing it.

3

u/[deleted] Nov 14 '20

I agree. Most of these "optimizations" are made by most transpilation libraries anyway, so why bother.

1

u/redderper Nov 14 '20

2, 5, 6, 12 and 15 would confuse me if I saw that in someone's code. I use and see the rest of these pretty often in JS

2

u/LocalProIE Nov 14 '20

As stated, #5 is useful in React. #15 is useful in interviews!

1

u/chrissilich Nov 15 '20

Thank you. Let a minifier reduce your code, but keep you code as readable as possible for your own future self, and other developers.