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...