Blog

Archive for the JavaScript Category


Prototype, new, Scope, this, and Classes Intro
Posted on September 16, 2020 in JavaScript by Matt Jennings

Way to use a prototype (__proto__ property on an object):

function userCreator(new, score) {
const newUser = Object.create(userFunctionStore);
newUser.name …

Read more


Ways to Create Objects
Posted on September 16, 2020 in JavaScript by Matt Jennings

Object literal
Dot notation
Object.create
// Create an empty object
const user3 = Object.create(null); // const user3 = {};

Generate an Object with a Function …

Read more


Rest Parameter vs Spread Operator
Posted on September 10, 2020 in JavaScript by Matt Jennings

Rest operator: collects all remaining elements into an array.

See the code example below:

function returnArr(…arr) {
return arr;
}

returnArr(1,2,3,4); // [1,2,3,4];

Spread operator: allows iterables …

Read more


Descructured Array Examples
Posted on September 10, 2020 in JavaScript by Matt Jennings

Array destructuring is the assignment part of a variable, not the declaration part.

// Non-destructured code
function data() {
return [1,, …

Read more


Destructuring Assignment in JavaScript
Posted on September 10, 2020 in JavaScript by Matt Jennings

Definition from MDN:
The destructuring assignment syntax is a JavaScript expression that makes it possible to unpack values from …

Read more