Velocidad de Escape

Standard built-in objects in JavaScript

> The term "global objects" (or standard built-in objects) here is not to be confused with the global object. Here, "global objects" refer to objects in the global scope. > The global object itself can be accessed using the this operator in the global scope. In fact, the global scope consists of the properties of the global object, including inherited properties, if any. <a class="hover:no-underline text-blue underline" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects#standard_objects_by_category" target="_blank" rel="noreferrer">Standard built-in...

JavaScript

Destructuring: From Zero to Hero

**Destructuring assignment** is probably one of the most importante features that came with ES6. Basically allow us unpack values from arrays, or properties from objects, into distinct variables. In older versions of ECMAScript this was a bit cumbersome: "Destructuring" arrays: ```js var myArr = ["Andres", "Bedoya"] // ES5 and previous var firstName = myArr[0] var lastName = myArr[1] // ES6 const [firstName, lastName] = myArr ``` "Destructuring" objects: ```js var myObject = { firstName: "Andres", lastName: "Bedoya" } // ES5 and previous var firstName = myObject["firsName"] var...

JavaScript

Stop using If else and Switch statements

This is quite difficult to explain, because I don't completely disagree with the use of if-else. The main reason for the existence of the switch statement was to avoid if-else structure in certain cases. Sometimes we have more than 1 comparison to do, since there could be many cases to evaluate, and at this point these statements become something tremendously verbose. ## Using if-else ```js function rating(rating) { if (rating === "five") { return "you are a super genius" } else if (rating === "four") { return "you are very smart" } else if (rating === "three") { return...

JavaScript

Redux VS Redux Toolkit

I've been working with Vue and Vuex for over 16 months, but React has always been the library of my loves, so I decided to start a short project with React, Redux and TypeScript to refresh my knowledge. _I have never been in favor of using TS on the frontend, it seems unnecessary to me, but hey, it is the subject of another conversation._ I decided to create my project using _Create React App_ using the Redux-TypeScript template, but I came across unexpected news; Redux has changed dramatically since I last used it. I had to start reading the official documentation again, luckily I came...

React