In python, I can do the following, to conditionally use a 2nd list if a 1st one is empty:
>>> x = [ ] or [1, 2]
>>> x
[1, 2]
In javascript, however,
>>> x = [ ] || [1, 2];
[ ]
So, if the “or trick” is off the table, I’m wondering whats the most concise way to do something like the following if-javascript-were-python-this-would-work pseudocode:
$elems = $('first-selector') || $('second-selector')
is not concise enough?
How about writing a little jquery extension?