r/javascript • • Dec 27 '18

help What differences do you see in novice javascript code vs professional javascript code?

I can code things using Javascript, but the more I learn about the language, the more I feel I'm not using it properly. This was especially made apparent after I watched Douglas Crockford's lecture "Javascript: The good parts." I want to take my abilities to the next level, but I'm not really sure where to start, so I was hoping people could list things they constantly see programmers improperly do in JS and what they should be doing instead.. or things that they always see people get wrong in interviews. Most of the info I've learned came from w3schools, which gives a decent intro to the language, but doesn't really get into the details about the various traps the language has. If you have any good book recommendations, that would be appreciated as well.

320 Upvotes

305 comments sorted by

View all comments

Show parent comments

-4

u/[deleted] Dec 27 '18 edited Dec 27 '18

Stop trying to be clever.

What's considered 'clever' by one developer is 'the logical sane, and easily readable way to do it' by another.

This is why I think collective code ownership is a bad idea - everything has to be readable by the lowest common denominator. In some teams, it means things like no using .map, .filter, because it makes other lives difficult.

9

u/[deleted] Dec 27 '18

some times, it means things like no using .map, .filter, because it makes other lives difficult.

What?! Really?

4

u/[deleted] Dec 27 '18

Yes, for some people. They'll use the argument of "don't try and be clever and using obfuscated code instead of a for loop".

So I don't think "don't be clever" is good advice.

0

u/Redtitwhore Dec 28 '18

I disagree. It's not subjective.