Protip to Dumbtip: avoid over-engineering
Today, I saw this JS code:
var that = (function () {
return this;
}).call(this);
Although it is syntactically and programmatically correct, it reveals one common anti-pattern in many devs: over-engineering
Please, stop thinking too much when it is not absolutely necessary.
Think of your goal, then go straight to it.
Written by Xavier Cambar
Related protips
2 Responses
If only they would have used a double-closure. That would have made it much better.
over 1 year ago
·
@nrutman And then obfuscate it.
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Javascript
Authors
Did you know?
JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.
Security insights from Cside
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#