title: What is the exact meaning of this code using the || ("OR") operator?
body: <p>I saw somewhere this code snippet:</p>
  
  <pre><code>var idx = SOME_VALUE;
  
  var color = {
    yellor: 1,
    red: 2,
    black: 0
  };
  
  var x = color[idx] || []; // Is this means if color[idx] is null, then return an empty array?
  </code></pre>
  
  <p>I can only guess the code <code>var x = color[idx] || [];</code> means if <code>color[idx]</code> is null, then return an empty array to x otherwise x= color[idx]. Am I right?</p>
  
  <p>Still, I need an explaination. Does this code has the same logic as the following?</p>
  
  <pre><code>CONDITION==VALUE? TRUE_goes_here : FALSE_goes_here
  </code></pre>