I'm comparing two objects like so:
if (obj1 !== null && obj2 !== null) {
// do thing 1
} else if (obj1 == null && obj2 == null) {
// also do thing 1
} else if (obj1 !== null) {
// return obj1
} else {
// return obj2
}
It feels really inelegant to include four lines for all four scenarios presented by the two objects/whether they exist. Is there a cleaner way to present this? Thanks!