Open panzerdp opened 3 years ago
Comment written by Felix Sanz on 01/16/2020 16:55:52
the fon't size example... i prefer the first one! return style.fontSize || 0;
. To me, this clearly shows what it does. I didn't understand this example probably, because i can deduct in this example that fontSize could be missing property
Comment written by Dmitri Pavlutin on 01/16/2020 19:26:03
I've never liked this form of defaulting because it doesn’t work well with a falsy prop value. Plus it uses side effects.
The destrucuring assignment with a default value is a better option, more clear, and doesn’t have the falsy problem.
Comment written by christo8989 on 09/13/2020 15:39:35
I agree with you Felix but I also think it depends on the team's style guide. The convention developers agree upon would make this code very clear (or not).
But, I like the article. I think this subject is so important.
Written on 01/14/2020 13:15:36
URL: https://dmitripavlutin.com/explicit-coding-discipline/