In other languages I have two sets of operators, or and ||, which typecast differently. Does Javascript have a set of operators to compare and return the original object, rather than a boolean value?
I want to be able to return whichever value is defined, with a single statement like var foo = bar.name or bar.title
There is only one set of boolean operators (
||,&&) and they already do that.Of course you have to keep in mind which values evaluate to false.