Async/Await (syntactic sugar on top of Promises)

ref – Promises paved the way to one of the coolest improvements in JavaScript. ECMAScript 2017 brought in syntactic sugar on top of Promises in JavaScript in the form of async and await statements. Async Declaring a function as async will ensure that it always returns a Promise so you don’t have to worry […]

Encapsulation in JS

ref –

Creating React Components Concept This is terrible coding because you are doing a lot of repetitive coding.

thus, functions were created:

…and therefore, we can easily call the functions and provide parameters:

How it Works in React Now, in React, say we want to render a bunch of h1. We have a index.html template […]

Arrow functions (js)

ref – When creating instances, every use of “new” defined its own ‘this’ value, where ‘this’ references the instance. The function defined in the constructor function will point to “this”. However, another function inside of that will not point to “this”. Say we create a literal object and assign a reference named […]

Prototype and Inheritance in JS (non-class) Creating objects through Constructor Functions Because each character will share many characteristics, such as having a name, and a level, we use a constructor functions to create templates for those common traits of each hero. Every hero has a name, and a certain level of experience

We have created a constructor function called […]

Workout and Boxing example for JS prototype and class

Workout First we have the Workout function class. Its declaration acts as the constructor. We have three properties: title, datetime, and notes.

Setting the Prototype to a object literal First, let’s define the function class Boxing. We will instantiate it, and pass it for Workout.prototype to point to.

set Workout’s prototype to a […]