December 7th, 2017
Native Getters & Setters
set keywords. They are commonly used for computing properties, as shown in the next example.
Setters can also perform validation on incoming data, such as type checking1:
November 26th, 2017
By combining Promises and Generators, we can create a function that handles asynchronous tasks (let's call it
async). This function takes one parameter - a generator function. Each
yield statement in the generator returns a promise, which calls the generators iterator once resolved. Therefore each asynchronous task in the
async function moves on to the next task in sequential order. Let's look at some pseudocode:
November 25th, 2017
The following code uses generators to create a fibonacci sequence.
November 21st, 2017
XMLHttpRequest object (which is as poorly named as AJAX - it can be used for much more than XML!)1.
I made a custom google search API which was really easy and fun to create2! It searches certain websites for cat related posts (and is appropriately called meowmeow)! Who wouldn't love that? In my code I retrieve the article names from the top 10 searches in my custom meow search. The code uses the
XMLHttpRequest object and a callback function:
November 20th, 2017
this works. Arrow functions look to 'fix' these confusions by implementing a lexical
this. Now the value of
this in an arrow function depends on what
this was equal to when arrow function was written (instead of when its called). This leads to confusing behavior if you are expecting arrow functions to act like normal function definitions. Let's look at an example.
November 15th, 2017
this from containing the global scope variable. What else does strict mode have to offer?
November 14th, 2017
Sorting Lists with Comparison Functions
November 13th, 2017
window, which represents the browser window. Window exposes an API for interaction with the Document Object Model (DOM), click listeners, and other information about the browser window1.
In the past I have used the
window object to check the current URL and previous page visited by the user (to create a 'back' button). However, the most common use of
window is to manipulate the DOM and set click listeners (I used frameworks such as JQuery to perform these tasks in the past).
November 12th, 2017
Challenges with Neo4j Graph Creation
In my last discovery post on graph databases and Neo4j, I created a graph representing a map of Fairfield County, Connecticut. I created nodes for all the towns/cities and edges between the settlements that shared borders. This discovery adds to the graph and shows some of the challenges I faced along the way. Let's dive in!
First I populated the graph with some people (after all, a settlement needs citizens!).
November 11th, 2017
this I took shortcuts such as the popular
var self = this statement so I wouldn't worry about the value of
this in nested functions.
this so confusing is that it's set at runtime instead of author time (compile time)1. In other words it doesn't follow the rules of lexical scope that I am comfortable with.
this is incredibly daunting for new programmers since its value can be different when calling the same function on separate occasions.
November 10th, 2017
ES6 Modules Run with Babel
The only change to the API is the
export is a new keyword in ES6 that reveals the function
November 9th, 2017
This module provides lyrics for Taylor Swift songs (because who doesn't enjoy some T-Swift!) The
return statement is the public API for the module. All interior details, such as the