title: How to set multiple local variables to the same value in a single declaration?
body: <p>Consider the following:</p>
  
  <pre><code>(function(){
     var foo = bar = 1;
  }());
  </code></pre>
  
  <ul>
  <li><em>foo</em> will be a local variable to the function</li>
  <li><em>bar</em> will be a global variable to the window</li>
  </ul>
  
  <p>Due to their scoping, both variables will have a value of 1 inside the function, but <em>bar</em> will persist outside the function (in global scope).</p>
  
  <p>I'm curious if there is a way to initialize variables using the <em>assignment operator</em>, <strong>without a loop or an object</strong>.  I'm looking for a keyword or prefix that would make <em>bar</em> locally scoped.  The idea is to be DRY and efficient.</p>
  
  <hr>
  
  <p>Edit:
  The example above is simple. One option, using 10 variables, might be to predeclare the variable to the local scope before initializing it:</p>
  
  <pre><code>var foo, bar, baz, foobar, foobaz, bazfoo, barbaz,
      bazbar = foo = bar = baz = foobar = foobaz = barbaz = true;
  </code></pre>
  
  <p>However, doing so is both repetitive and harder to read.  A person could use an array or object, but that is a little less clear and more cluttered.</p>
  
  <p>The background was that another developer was doing <code>var foo = bar = true</code> inside a function, which I pointed out is only setting one local variable.  They were not aware of that and wanted to change and asked if it's possible to inline and set multiple local variables, without typing each one multiple times (and not refactor code w/ array or object).  </p>
  
  <p>Upon originally asking this question, I was exposed to ES6, but had yet to fully read the docs.  My thinking was that ES6 has some nice features (e.g., rest, destructuring assignment) and so perhaps it also provided a way to massively initialize a large block of variables to the same scope and value.</p>