Хабр Курсы для всех
РЕКЛАМА
Практикум, Хекслет, SkyPro, авторские курсы — собрали всех и попросили скидки. Осталось выбрать!
result = person?.address?.houseName?
var result, _ref;
result = (typeof person !== "undefined" && person !== null ? (_ref = person.address) != null ? _ref.houseName : void 0 : void 0) != null;
var person = { address: { postalCode:12345 } };
var postalCode = person
&& person.address
&& person.address.postalCode;
var spouse = person
&& person.spouse
&& person.spouse.firstName
|| "<not married>";
alert(postalCode);
alert(spouse);
public static TOutput Select<TInput, TOutput>(this TInput src, Func<TInput, TOutput> next)
where TInput : class
where TOutput : class
{
if (src == null) return null;
return next(src);
} var houseName = from a in person.Address
select a;
Скринкаст: монада Maybe на языке C#