I have this nested and ugly working code which I want to simplify. I want to make it cleaner without throwing any error if a value is missing. Anyone can suggest a cleaner way to do this?
const addressId =
customer &&
customer.addresses &&
customer.addresses[0] &&
customer.addresses[0].id