title: Javascript: Brackets after an array in braces
body: <p>I've just run into a piece of code I've never seen before, and can't find an explanation anywhere online:</p>
  
  <pre><code>function segColor(c) {
      return {
          red: "#FF0000",
          green: "#00ff00",
          blue: "#0000ff"
      }[c];
  }
  </code></pre>
  
  <p>What operation is being done to the function parameter c? What does {array}[val] do in javascript? Searching for "brackets after braces" doesn't really reveal a lot. </p>