Re:Args.js – Optional and Default parameters for JavaScript
by niyazpk on Monday January 13, 2014 @10:54AM
(#7051244)
Yes, the second option is better in most cases. I'd spend more time reading the first one to understand what is going on compared to the second option.
Keep in mind that you will have to go for the first option (or other better options) if you expect 'falsy' values to be passed as arguments.
Keep in mind that you will have to go for the first option (or other better options) if you expect 'falsy' values to be passed as arguments.