Is there a one-liner code where I can say the assigning of a variable is to a populated array from a choice of 2 array?
For example:
I'd like:
var myArray = ['a','b','c'];
The choice is between 2 arrays.
var a = [];
var b = ['a','b','c'];
So basically if var a is populated, I'd like myArray to = a. If var a is not populated but var b is populated, myArray = b; if var a and b are empty, then myArray = [];
I've tried the following to no avail:
var myArray = a || b || [];
a.length > 0 ? a : b?