title: Alternative to the "switch" Statement
body: <p>I do not want to use Switch in my code, so I'm looking for some alternative</p>
  
  <p><strong>Example with Switch:</strong></p>
  
  <pre><code>function write(what) {
  
    switch(what) {
  
      case 'Blue':
        alert ('Blue');
      break;
  
      ...
  
      case 'Red':
        alert ('Red');
      break;
  
    }
  
  }
  </code></pre>
  
  <p><strong>Example without Switch:</strong></p>
  
  <pre><code>colors = [];
  
  colors['Blue'] = function() { alert('Blue'); };
  colors['Red'] = function() { alert('Red'); };
  
  
  function write(what) {
  
    colors[what]();
  
  }
  </code></pre>
  
  <p><strong>My questions are:</strong></p>
  
  <ol>
  <li>Do you know any other alternatives?</li>
  <li>Is this best solution?</li>
  </ol>