Tue, 23rd Apr 2019, 06:47

This is a big reason why I still use lodash or Ramda in a number of my projects. Clever code is rarely readable code. It feels good when you write it, but in a team working on production code readability is your no. 1 priority.

Javascript syntax has come a long way, but sometimes a utility library is still useful to abstract common patterns that would be verbose or unreadable with today's js syntax.


Clever JavaScript does not mean simple or readable

Clever JavaScript does not mean simple or readable

Last week, someone tweeted: Woah, this is elegant JavaScript. Need to conditionally add a property to an object? Here’s a slick approach. The right-hand side is only applied if the condition is true. If the condition is falsy, the spread operator does nothing. They shared this code snippet from an article by Andrea Simone Costa: const obj = { ...condition && { prop: value }, }; This is not a dig at Andrea.