Jennifer Bland header image
≡ Menu

How Hoisting in JavaScript Can Cause Unexpected Results

Your can experience unexpected results in your JavaScript programs due to execution that does not occur like you expected. A good example of this is that you can actually use a variable in JavaScript before you declare it. Here is an example:

x = "Jennifer";
for (var i = 0; i < 10; i++) {

var x;

JavaScript allows this code to function due to a concept known as "hoisting." Hoisting the default behavior of a JavaScript application once it executes.

Within the current scope in a JavaScript application, all variables are "hoisted" to the top regardless of where they are declared.

Continue Reading ➞

Breadth First Search in JavaScript

In my previous post I discussed the difference between a graph data structure and a tree data structure. Now that you understand the difference between the two data structures, I am going to show you how you can search through your data.

The two most common methods of searching a graph or a tree are depth first search and breadth first search.

Whether to use a depth first search or a breadth first search should be determined by the type of data that is contained in your tree or graph data structure.

Continue Reading ➞

The Difference Between a Tree and a Graph Data Structure

In JavaScript programming, data can be stored in data structures like graphs and trees. Technically trees are graphs.

Graphs Data Structures

Graphs evolved from the field of mathematics. They are primarily used to describe a model that shows the route from one location to another location.

A graph consists of a set of nodes and a set of edges. An edge is a pair of nodes that are connected. A path is the term used to describe traveling between nodes that share an edge. The image below shows a graph with 3 nods and 3 edges.

graph data structure with 3 nodes and 3 edges


Continue Reading ➞

Hack Reactor Week 2 Review

Just completed my second week at Hack Reactor. The first hour of Monday was spent on completing a self assessment used to measure how well we learned the material covered in the first week. We were given 5 exercises that we had to complete in a 30 minutes.

The 5 exercises covered the major topics that were covered in our first week at Hack Reactor. Here are the exercises we had to complete:

  • Write a reduce function
  • Write two new methods that would extend the Array prototype
  • Describe differences between a stack and an array
  • Write a stack function
  • Write a function to handle collision in a hash table

Continue Reading ➞

Hack Reactor Week 1 Review

Just completed my first week of training at Hack Reactor. Hack Reactor is an intensive 13 week long JavaScript programming boot camp. Classes run Monday thru Saturday from 8:30 AM PST to 8:00 PM.

My first week I spent a grand total of 75 hours in classes. I also did an additional 9 hours of studying and programming outside of classes. All total in the first week I spent 84 hours in training.

Before you start your first day of classes you have already completed an immense amount of pre-course material. If you want to know what is covered then you can check out my post about my pre-course work at Hack Reactor.

Continue Reading ➞