Los 10 problemas más comunes que los desarrolladores de JavaScript experimentan

Muy interesante la lista que aparece en The 10 Most Common JavaScript Issues Developers Face:

At first, JavaScript may seem quite simple. Yet the language is significantly more nuanced, powerful, and complex than one would initially be led to believe. Many of JavaScript’s subtleties lead to a number of common problems—10 of which we discuss here—that keep code from behaving as intended. It’s important to be aware of and avoid these pitfalls in one’s quest to become a master JavaScript developer.

Los monstruos que crea JavaScript

Muy graciosas las respuestas que se han publicado en Quora a la pregunta Why is VSCode nearly 300 megabytes while Sublime Text is just 16 megabytes?:

Because Visual Studio Code is based on Electron, which is a horribly, horribly bloated framework that combines the Chromium rendering engine with the Node.js runtime. Writing an application to execute in a web browser is the worst imaginable way to develop software. It’s way over-engineered and overly complicated. And Node.js (JavaScript) is typically 2–6X slower than C++.


Visual Studio Code is a web browser with a code editor glued onto the side using expired epoxy.

VSCode is built on the Chromium rendering engine, which is made to render webpages, and is likely rendering this answer right now. The entire application is written using the duct tape monster that is Javascript. It’s a surprise that it is just 300 megabytes.


Using bloated web based frameworks to implement a desktop application does not make much sense, but .. anyway…

 

Uso de null y undefined en JavaScript

Los valores null y undefined suelen dar muchos dolores de cabeza a los programadores. En el artículo Handling null and undefined in JavaScript se explica cómo se deben usar en JavaScript:

One aspect of JavaScript development that many developers struggle with is dealing with optional values. What are the best strategies to minimize errors caused by values that could be null, undefined, or otherwise uninitialized at runtime?

Some languages have built-in affordances for those circumstances. In some statically typed languages, you can say that null and undefined are illegal values, and let your programming language throw a TypeError at compile time, but even in those languages, that can’t prevent null inputs from flowing into the program at runtime.

To get a better handle on this problem, we need to understand where these values can come from. Here are some of the most common sources:

  • User input

  • Database/network records

  • Uninitialized state

  • Functions which could return nothing

Cómo manipular los colores CSS con JavaScript

Un excelente artículo How to manipulate CSS colors with JavaScript:

I know you’re here to learn about manipulating colors — and we’ll get there. But before we do, we need a baseline understanding of how CSS notates colors. CSS uses two different color models: RGB and HSL.

Both the RGB and HSL color models break down a color into various attributes. To convert between the syntaxes, we first need to calculate these attributes.

With the exception of hue, each value we have discussed can be represented as a percentage. Even the RGB values are byte-sized representations of percentages. In the formulas and functions below, these percentages will be represented by decimals between 0 and 1.

I would like to note that I will not cover the math for these in depth; rather, I will briefly go over the original mathematical formula and then convert it into a JavaScript formula.

JavaScript, ese lenguaje malo malo malo

Lenguaje malo y con programadores ignorantes, según podemos leer en Quora en la siguiente respuesta a la pregunta Which commonly used programming language has the most ignorant programmers on average?:

Hands-down, it’s JavaScript. The number of really, really bad JS devs out there staggers the mind. They are responsible for the huge number of crap JS libraries, especially in the npm repositories.

They actually believe that JavaScript is sprinkled with fairy dust. They think JavaScript is somehow unique in terms of features and capabilities, when, in fact, there is absolutely nothing new nor special about this poorly designed language. Dynamic typing? Prototypes? Lambdas? Asynchronous programming? We’ve seen them all before in other languages.

[…]

I agree with Ryan Gedwill’s answer. “JavaScript is the most ignorant community because they don’t understand the word simple.”