DEV Community


Discussion on: Top 20 JavaScript tips and tricks to increase your Speed and Efficiency

rockson profile image
Rok Zigon
   arg1 = arg1 || 10; 
// set arg1 to 10 as a default if it’s not already set 
Enter fullscreen mode Exit fullscreen mode

Comment should warn that if you use || to provide some default value, you may encounter unexpected behaviors if you consider some falsy values as usable (e.g., '' or 0).

erasmuswill profile image
Wilhelm Erasmus

You're making me relive production drama right here :(