Anyone have an example of 'needlessly terse and slightly egotistic code'? I'm writing a piece on patterns to avoid in JS.. Like flooring using bitwise operators, using + instead of Number(), and over-use of regex.
-
Show this thread
-
Replying to @padolsey
foo && doSomething(); instead of if (foo) doSomething (); Same with || etc.
1 reply 0 retweets 4 likes
But more generally: doing too much on a single line (to avoid additional variables, for example). Make each line do only one or two things and everything becomes much easier to follow. Minifiers and JS engines are smart enough to optimize anyhow.
5:14 AM - 28 Apr 2019
0 replies
0 retweets
1 like
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
JavaScript, HTML, CSS, HTTP, performance, security, Bash, Unicode, i18n, macOS.