Code

General Code

Constructor Functions

In traditional OO languages, constructor functions are a normal part of the code. Constructor functions are denoted by a capital letter by practice. Constructor functions look like “regular functions, but behave differently. Here is an example… Notice the capital “A”. That is a JavaScript constructor function convention. Also, notice we are using the “new” keyword. […]

Constructor Functions Read More »

Bind

Bind allows us to copy a function. Why would we want to do this? By copying it, we change the context of “this” for the entire new function. Here is an example… The output would be “George”. This was possible because we used bind to copy the original function to the newAnimal function. This also

Bind Read More »

Arrow Functions

Traditionally, functions are defined in JavaScript by using the “function” keyword. In ES2015, arrow functions were introduced. For C# folks, this will look similar to lambdas. Let’s first look at a traditional function syntax… The output would be “Bongo”. Let’s change the syntax to using arrow function syntax… This would also output “Bongo” to the

Arrow Functions Read More »