title: How to know if JS code is executing in browser or in design mode
body: <p>I believe intellisense can solve a lot of time and bugs. Lets say I make an ajax call and I know I will get an array of cars.</p>
  
  <pre><code> $.ajax({
          type: "POST",            
          url: "GetCars.aspx",
          success: function (cars) {                
  
              for(var i = 0; i &lt; cars.length; i++)
              {
                  var car = cars[i];
                  if(document.designMode)
                  {
                     car = { type: "", model: 0, colors: new Array() };
                  }
                  // Intelissense wors great in here!
  
                  // car.   "the moment I type the '.' I see type, model, and colors
  
              }
          }            
      });
  </code></pre>
  
  <p>I need something that will return true in visual studio editor and false in the browser. <code>if(document.designMode)</code> returns true in VS and in the browser so the line <code>car = { type: "", model: 0, colors: new Array() };</code> is always executed. <strong>I don't want the line <code>car = { type: "", model: 0, colors: new Array() };</code> to be executed on the browser only on VS so I get intellisense</strong>. How can I do that?</p>
  
  <hr>
  
  <h2>Solution</h2>
  
  <p>Thanks to @Shoms I came up with:</p>
  
  <pre><code>    var car = null;        
  
      if (window.navigator.userAgent.length === 212) {         
          car = { type: "", model: 0, colors: new Array() };
      }
  
      // Intellizense works great :)
  </code></pre>
  
  <p>Note your VS might require a different number. For me I have to try > 500 then &lt;250 ,  &lt; 125  etc until I found that it is length 212. </p>