So You Want to be a Functional Programmer (Part 2)
Charles Scalfani

Great article! I’m really looking forward to the next chapter.

But just a friendly notice:

The “regex.exec”-function doesn’t really work as expected if someone is trying to follow along and writing the code the self (as I did). The “exec” function is created with regex as its “this”-object. But when it is called the “this”-object has shifted to something else — in the browser that’s probably “window”.

So solve this issue, if someone like me encounters this it’s better to write the “createRegexParser”-function as this instead:

function createRegexParser(regex) {
 return regex.exec.bind(regex);
 // or even: return RegExp.prototype.exec.bind(regex);

Thanks again, when will we be able to read the next part?

Show your support

Clapping shows how much you appreciated Adam Bergman’s story.