3 ms·
I would argue that the biggest issues with JavaScript are: - Most obvious solutions to simple problems are often wrong. (Examples: iterating over a "dictionary
by romaniv 15y ago
I would argue that the biggest issues with JavaScript are:
- Most obvious solutions to simple problems are often wrong. (Examples: iterating over a "dictionary", getting a variadic function to work.)
- Callbacks that create callbacks and so on (hard to understand the real structure of the program) and callbacks that are shoved into global variables (hard to debug).
- Insane type conversion paired with poor error logging. (This has nothing to do with being dynamically typed, BTW. You can be dynamically strongly typed or at least have some safeguards.)
- sixbrx 15y agoI'd add that it's too easy to pollute the global scope accidentally, because a simple anonymous block structure (e.g. braces) to scope variables is not allowed. Best workaround is to wrap most all code in an anonymous function that is then immediately executed (function() {<your code here}}).(), but that's ugly and easy to forget. I think Coffeescript does this by default for all blocks of code, which IMO is one of the principal reasons for preferring it to original javascript.
- lowboy 15y ago> which IMO is one of the principal reasons for preferring it to original javascript. It's a nice feature, but saying it's one of the principle reasons to prefer CS over JS is a stretch. Wrapping your entire file in an IIFE is a one-time development cost and a simple pattern to remember. Compare that to the syntactic sugar, safeguards, and added functionality that one will leverage constantly during development.