How to Create a 2D Array in JavaScript

JavaScript does not have a special syntax for creating multidimensional arrays. To create a 2D array in JavaScript, we have to create an array and then make each element of the array an array as well. That means we create an array of arrays. Example: The problem with this approach is that each element of… Read more

Published on March 26th, 2014 by Stephani

What is Node.js?

Node.js has been causing a lot of buzz around the web. What is node.js? Why is everyone talking about it? Briefly, Node is: A sever-side solution for JavaScript Highly parallel but single threaded Runs JavaScript, but it is NOT JavaScript Server-side solution for JavaScript Node is a server-side solution that can be programmed in Javascript…. Read more

Published on March 14th, 2014 by Stephani

What Is The Difference Between Event Bubbling and Event Capture?

Let’s start with an example: If you click on the inner-div, it will cause a click event on both divs (inner-div and outer-div), but which event fires first? Event Capture: The event handler of outer-div fires first, then event handler of inner-div fires last. Event Bubbling: The event handler of the inner-div fires first, the… Read more

Published on September 26th, 2013 by Stephani

Creating a Queue in Javascript

To create a queue in javascript simply use an array. Arrays in javascript already contain both queue and dequeue methods necessary to manipulate a queue. They are just not called queue and dequeue. To enqueue into a queue, simply use the method push. To dequeue from a queue, simply use the method shift. The method… Read more

Published on September 25th, 2013 by Stephani

Creating a Stack in Javascript

To create a stack in Javascript simply use an array. Arrays in javascript already contain both push and pop methods necessary to manipulate a stack. The method pop() removes the last element in the array. This creates a LIFO (Last in, first out) effect. If you want to create a stack object with more methods,… Read more

Published on September 25th, 2013 by Stephani
load more...