I'm writing a simple JavaScript game that uses an object to represent a set of teams with scores and other values for the current game as well as previous games. The object will look something like this:
var leaderboard = [
{team:"Black", captain:"Sparrow", score: 100, treasureFound: 500, totalTreasure: 5000, wins: 2},
{team:"Blue", captain:"Smollett", score: 5, treasureFound: 0, totalTreasure: 200, wins: 1},
{team:"Green", captain:"Hook", score: 10000, treasureFound: 4500, totalTreasure: 25000, wins: 10}
];
What I'd like to do is reset the score values after each game while persisting the running total values for the session. One way to do this would be with a loop, but I'm wondering if there's a cleaner way to do this without explicitly looping through each team to set all the scores to the same value of 0. Any thoughts?
Here's a fiddle for it: http://jsfiddle.net/2gbgkLg3/1/
Edit: the original question text referenced looking for a non-iterative syntax, but I think this was confusing and distracted from what I was really asking, so I altered it.