title: Switch statement / conditional in map function JS
body: <p>I'm using react and am trying to map over an array and create objects:</p>
  
  <pre><code>var levels = this.props.levels.map((level, i) =&gt;
    &lt;img key={i} src={levelImg} className={styles.level} /&gt;
  );
  </code></pre>
  
  <p>Is it possible to do something like this:</p>
  
  <pre><code>var levels = this.props.levels.map((level, i) =&gt;
    switch (i) {
      case 1:
        // do something
        break;
      case 2:
        // do something
        break;
      case 3:
        // do something
        break;
    }
    // ...
    &lt;img key={i} src={levelImg} className={styles.level} /&gt;
  );
  </code></pre>
  
  <p>I'm getting a syntax error when I try something like that.</p>