Enumerating JavaScript Objects

2010-05-25T22:57:38+00:00 August 22nd, 2006|JavaScript|

The global forEach function allows us to enumerate any object according to it’s type. If the object is array-like (has a length property) then we enumerate it like an array. All other objects are enumerated using the standard for var x in y mechanism.

Event Handlers and Callback Functions in JavaScript

2010-05-25T22:59:07+00:00 August 19th, 2006|JavaScript|

In Higher Order Programming in Javascript I discussed the various ways of using functions as values. One particular trick in that document caught the attention of Dan Shappir, who pointed out to me: "your technique shows how JavaScript supported delegates all along, so this is not some great C#/.NET invention."

Higher Order Programming in JavaScript

2010-05-25T22:58:54+00:00 August 18th, 2006|JavaScript|

Higher Order Programming is the ability to use functions as values. So you can pass functions as arguments to other functions and functions can be the return value of other functions. This style of programming is mostly used in functional programming, but it can also be very useful in 'regular' object oriented programming.