How do I write an || expression in Javascript where 0 isn't treated as a falsy value?
<p>Please forgive my English. I am not a native speaker.</p>

<p>My problem comes when I write code like this</p>

<pre><code>luminosity = settings.luminosity || 50;
opacity = settings.opacity || 100;
</code></pre>

<p>The problem is that <code>0</code> is supposed to be a valid value, but it will be overlook because <code>0</code> is falsy in Javascript and it will set to the default value on the right of <code>||</code>.</p>

<p>Is there a way to do a fix so <code>0</code> isn't treated as falsy?</p>

<p>Right now I am doing</p>

<pre><code>luminosity = "luminosity" in settings ? settings.luminosity : 50;
</code></pre>

<p>but I don't like that because it is so long.</p>
