Одной штуки, конечно, не хватает в JS, которая есть в Кофе:
zip = lottery.drawWinner?().address?.zipcode
Цитата:
|
The accessor variant of the existential operator ?. can be used to soak up null references in a chain of properties. Use it instead of the dot accessor . in cases where the base value may be null or undefined. If all of the properties exist then you'll get the expected result, if the chain is broken, undefined is returned instead of the TypeError that would be raised otherwise.
|