Turn string to object within _.each
<p>I'm using underscore in an Angular controller and attempting to turn a string into an object with several properties.    </p>

<pre><code>vm.availableGames = _.each(availableGames, function(game) {
  game.name = game;
  if (_.contains(user.allowed_games.games, game)) {
    game.allowed = true;
  } else {
    game.allowed = false;
  }
});
</code></pre>

<p><code>availableGames</code> is an array of strings of available games
<code>allowed_games</code> is also an array of strings of allowed games</p>

<p>My aim is to create an array of objects (<code>vm.availableGames</code>) which contains all available games. Each of these objects will have a name property (the original string) and an allowed property (a boolean).</p>

<p>The above code results in a <code>Cannot assign to read only property...</code> error. How would I go about accomplishing what I'm aiming for without running into this error?</p>