Async/Await (syntactic sugar on top of Promises)

ref – https://www.toptal.com/javascript/asynchronous-javascript-async-await-tutorial 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 – https://abdulapopoola.com/2013/03/30/static-and-instance-methods-in-javascript/

Creating React Components

https://www.kirupa.com/react/components.htm 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 – https://medium.com/@thejasonfile/es5-functions-vs-es6-fat-arrow-functions-864033baa1a https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions https://dmitripavlutin.com/when-not-to-use-arrow-functions-in-javascript/ 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)

https://www.digitalocean.com/community/tutorials/understanding-prototypes-and-inheritance-in-javascript 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 […]