I know an if statement can easily accomplish this. I'm just wondering if there's anything that could be done even more simply.
For example:
var a
var b='this has a value'
var c = don't use a, instead use b
If a, if defined, will be truthy, just alternate:
var c = a || b;
let a1;
let b1 = 5;
let c1 = a1 || b1;
console.log(c1);
let a2 = 'truthy';
let b2 = 10;
let c2 = a2 || b2;
console.log(c2);
Otherwise, if a can be defined but falsey, use the conditional operator:
var c = a !== undefined ? a : b;
let a1 = null;
let b1 = 5;
let c1 = a1 !== undefined ? a1 : b1;
console.log(c1);
undefined, or about the global undefined property having been overwritten (in very ancient environments, pre-ES5), but those are very strange edge cases
afor you to not want to "use" it?