title: How do I send assign a List<string> to a JavaScript array or enumerable object
body: <p>I have the following :  </p>
  
  <pre><code>ViewBag.SomeEnumerable = new List&lt;string&gt;() { "string1", "string2" };
  </code></pre>
  
  <p>Now how do I assign <code>ViewBag.SomeEnumerable</code> to an <code>array</code> or some form of enumerable object on the JavaScript side? e.g.:</p>
  
  <pre><code>function SomeFunction()
  {
    var array = @ViewBag.SomeEnumerable;
    for(var eachItem in array)
    {
      alert(eachItem); // should display "string1" then string2"
    }
  }
  </code></pre>