Blog

Archive for the JavaScript Category


Subclassing (Inheritance)
Posted on September 19, 2020 in JavaScript by Matt Jennings

Factory Function Example

// userCreator is a factory function
function userCreator(name, score) {
// Create an object newUser that includes

Read more…


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

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

Spread operator:
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.

Destructured Array Code Examples

// Non-destructured code
function data() {

Read more…

To Top ↑