× {{alert.msg}} Never ask again
Get notified about new tutorials RECEIVE NEW TUTORIALS

not sure how to ask this but what are they trying to do here?

Michael Perrenoud
Feb 06, 2015
<p>It's saying that if <code>members</code> is something that is <strong>not</strong> <code>undefined</code> or "falsey" then it will set it to <code>members</code> otherwise it will set it to a new empty JavaScript object.</p> <p>This type of code is often used if the code is run through more than once. The first time through <code>members</code> would normally be <code>undefined</code> but subsequent times it would have a value you didn't want to lose.</p> <p>Things to watch for with these types of statements: some real values like <code>0</code> or <code>false</code> will evaluate to a "falsey" condition. In this case that's not an issue. In the future if you use something like that keep that in mind. Anything "falsey" will default to the "other side" of the <code>||</code> statement. In this case the <code>{}</code>.</p> <p>This tip was originally posted on <a href="http://stackoverflow.com/questions/27838801/not%20sure%20how%20to%20ask%20this%20but%20what%20are%20they%20trying%20to%20do%20here?/27838819">Stack Overflow</a>.</p>
comments powered by Disqus