In Ruby, I can write a || b and the function will choose a if it exists, and if not, b.
How can I do this in JQuery without writing something grossly cumbersome like:
if (a){
a
} else {
b
}
Also, does JQuery have an equivalent to Ruby’s a ||= b?
jQuery is just a JavaScript library and in JavaScript we have the same.
This is because