getify / Functional-Light-JS

Pragmatic, balanced FP in JavaScript. @FLJSBook on twitter.
http://FLJSBook.com
Other
16.6k stars 1.96k forks source link

Ch8: Sugestion and minor typo fix #121

Closed fcasad closed 6 years ago

fcasad commented 6 years ago

Yes, I promise I've read the Contributions Guidelines

Purely subjective - but maybe something like this would be slightly easier to read..? It was just a little bit harder to read the nested ternaries in the last snippet Anyway thank you for your work on this book and the YDKJS series!! Seriously awesome stuff :)

getify commented 6 years ago

I fixed the Chapter 7 vs 9 reference, thanks, good catch. I also appreciate the suggestion on refactoring.

However, I'm going to leave these in their ternary forms, because part of the point of the book is we're trying to get away from imperative-looking code like if statements. We're certainly trying to get away from techniques like assigning multiple times (or conditionally) to a single variable, as this is the kind of code that leads to confusing (bug prone) flow control of data. The strong preference is to have a single assignment for any variable, if at all possible.