title: ES6 block scoping with in switch
body: <p>In ES6, I can achieve block scoping per case: </p>
  
  <pre><code>switch(somVar){
      case 'first': 
      {
          let itemId='foo'; 
      }
      break; 
      case 'second': 
      { 
          let itemId='bar'; 
      } 
  } 
  </code></pre>
  
  <p>Obviously, <code>itemId</code> might as well be declared on top.<br>
  For my use case, locally scoped variables make more sense because in my overall code, it is more easily identifiable what's happening, and there are a number of <code>case</code>'s, whereas some blocks contain the variable in question and others don't.  </p>
  
  <p>I have't seen block scoping used for <code>switch/case</code> as common usage.<br>
  My question is simply, whether there are reasons not to do it, stylistic-wise or else. </p>
  
  <p>Edit, updated example code to avoid confusion: </p>
  
  <pre><code>const someFunc(action) =&gt; { 
      switch(action.type){ 
          case 'first': 
          { 
              let itemId=action.someObj.someProp.id; 
              //Do something with itemId
          } 
          break; 
          case 'second': 
          { 
              let itemId=action.someObj.someProp.id; 
              //Do something with itemId
          } 
          break; 
          case 'third': 
              //No use of itemId 
      } 
  } 
  </code></pre>
  
  <p>itemId could be declared at the top, but I'd prefer to look at the property per case. There doesn't appear to be an immediate reason to share the variable across different cases. It would also appear to be nonsense to 'invent' a different name for what is essentially the same.   </p>
  
  <p>This could probably be written differently, but this example is a common pattern in Flux architecture.  </p>