title: Array of boolean values in JavaScript
body: <p>In JavaScript, is there a way to do this in a more efficient way?</p>
  
  <p>I need to create an array of boolean values, change them and check them individually and at random.</p>
  
  <p>The goal is better performance.
  Maybe manipulating bits.</p>
  
  <p>Right now I use something like this:</p>
  
  <pre><code>var boolean = [];
  
  var length = 100; // set a random number of values
  for (var i = 0; i &lt; length; i++) boolean[i] = false; // or true
  
  boolean[n] = true; // change some of the values randomly
  if (boolean[n]) { /* something */ } // check some of the values randomly
  </code></pre>