Functional Style Mind Shift in JavaScript

In my job as a front-end developer and consultant I speak to other developers a lot about how to write code. Let’s be honest, actually there is no holy grail of how to write code. There are different opinions and just many factors like stability, re-usability, maintainability, code scannability (which is also very subjective), performance, testability, beautifulness (Admit it! Sometimes you just prefer sexy beautiful code over efficient code!) and probably many many more. However, I strongly believe, that a few of these factors are more important than others depending on the context. While talking to developers and performing JavaScript code reviews at clients, I always figured out that people who adopted to a more functional style of writing JavaScript, created much more readable, maintainable and efficient code.

In this article I would like to show you a few examples how ECMAScript 5.1 changed the way I write code and how I learned to prefer, readable, maintainable and functional code over the lame old-school procedural (but sometimes more performant) code.

Functional programming computer screen

Continue reading