Coming from the rubyesque crowd I was very fond of the following 'lazy' initialization pattern.
myhash[:property]||='value'
And sometimes during my career I adapted it to javascript as following:
myhash.property || (myhash.property = 'value')
A co-worker remarked that it's quite irregular, and to be honest I can't remember seeing other people using that pattern.
So my question is; Is it just another innocent initialization flavor or am I unintentionally asking for trouble?
Given the execution flow of conditional statements like that I suppose It is possible to use it as an if statement aswell:
aModel.valid && aModel.save();
or even something more insane..
willYouMarryMe === 'yes' && (function(){
console.log('Wohoo!');
})();