Closed fcasad closed 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.
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 :)