Open akidee opened 13 years ago
I did once upon a time have one (actually I invented the one in CoffeeScript :)
I should be able to bring it back as I agree, it was useful. I decided to make it a little simple here though : more like a non-strict comparison with null, so your example would work like :
zip = (_ex = lottery.drawWinner()) != null && _ex.address && _ex.adress.zipcode
I've put up a gist to explore the possibilities here :
In CS, this a feature I heavily use when writing templates, and it is very useful, since it makes your code more safe (because null/undefined will throw an error on accessing properties)
Example: