The joy of recursion, immutable data, and pure functions: Making mazes with JavaScript
Generating mazes might not be something you do a lot in your typical front-end job. Some might call it a waste of time. Why bother if you’re not a game developer? Who needs that kind of thing?
Sure, it might not be essential, but it’s a lot of fun.
Building mazes also presents interesting real-world challenges. How do we deal with random numbers if we’re creating pure functions? How do we implement a repetitive algorithm without using loops? How do we work effectively with immutable data structures? And most importantly, can we have some fun while we’re at it?
James Sinclair
James is the author of “A Skeptic’s Guide to Functional Programming with JavaScript.” As you might imagine, he’s passionate about functional programming. Specifically, how it can help us write better code—in whatever language you happen to be writing.
Over the years, he’s worked on web projects for Atlassian, Ford, Bendigo Bank, the Australian Broadcasting Corporation, and the Prime Minister of Australia. Somewhere along the way, he picked up a PhD in Information Architecture. But building stuff on the web seemed a lot more fun than academia. In his spare time, he trains in Brazilian Jiujitsu. He also writes articles about web development at https://jrsinclair.com.