Blog

JavaScript – indexOf Iterator Via A Generator

Yesterday, I posted about creating String.prototype.indexOfIter() which basically returned a function which would act as an iterator function, indicating the indices of the specified substring. What I neglected to include was how to write this solution using JavaScript 1.7 in FireFox. Today, I bring to you the equivalent using a Read more…

By Chris West, ago
Blog

JavaScript – indexOf Iterator

One of the cool things about JavaScript 1.7 is the fact that it supports generator functions. Unfortunately, not all browsers support generator functions yet. Therefore, when creating iterators we can look to an interesting alternative: closures. For example, if our goal was to make a String prototype function which would Read more…

By Chris West, ago