Monday 29 April 2019

calling function with an empty parameter - what do you use null or undefined?

If there is a function foo(x, y, z) and you want to call it with empty parameter 'y', what is better/more used and why? :foo('lala', null, 2); //or foo('lala', undefined, 2); function foo(x, y, z) { if (x) console.log(x); if (y) console.log(y); if (z) console.log(z); }

Submitted April 29, 2019 at 10:52PM by making_bugs

No comments:

Post a Comment