re: Differences between "null" and "undefined" keywords? VIEW POST

FULL DISCUSSION
 

The new optional parameter for ES6 only cares about undefined.

function myFunc(a, b = 0) { console.log(a,b); }
myFunc(1); // 1 0
myFunc(1,null); // 1 null
myFunc(1,undefined); // 1 0
myFunc(1,getSomeNonExistingValue()); // 1 (null or 0)

Wouldn't it be simpler to use undefined instead of null everywhere? Just stop using null?

 
code of conduct - report abuse