To deal with default argument value, we often use :
a = a || defaultValue;
or when a falsy value can be a valid argument :
if (a===undefined) a = defaultValue;
I think we could have some helpful sugar here, by which the last LOC would be written
a \= defaultValue;
An advantage is that it would limit the profusion of buggy a = a || defaultValue;
.
\
would also be used as operator in expressions :
(a\defaultValue);
which would be similar to
(a!==undefined ? a : defaultValue)
(defaultValue
not being evaluated if a
is defined)
A possible coherent extension would be the definition of default literal values in a function definition :
function fun(a\defaultValue, b\someOtherDefault, c){