title: How to assign a List<string> to a ViewBag and use in JavaScript?
body: <p>I create and assign values to a list of strings in my controller. I want to assign the list of values to a JavaScript variable. How can I do this? </p>
  
  <p>Controller:</p>
  
  <pre><code>List&lt;string&gt; fruits = new List&lt;string&gt;();
  list.Add('Apple');
  list.Add('Banana');
  list.Add('Kiwi');
  ViewBag.FruitList = fruits;
  </code></pre>
  
  <p>View:</p>
  
  <pre><code>var fruitList = '@ViewBag.FruitList';
  </code></pre>
  
  <p>When I run the program <code>fruitList</code> comes back as <code>System.Collections.Generic.List 1[System.String]</code></p>