How to add to this array?

How do I add a value to this array. I am looping over xml and need to create the following array but dont know how to work with it.

var projects = [
{id: ‘123’,label: ‘Burger King’,desc: ‘Burger King Dallas, TX 75233’},
{id: ‘234’,label: ‘Chic Fila’,desc: ‘Chic Fila Chicago, IL 12255’},
{id: ‘345’,label: ‘Chipotle’,desc: ‘Chipotle Terrell TX 85211’}
];

Would apprecaite any help.

To add a value:


var projects = [
{id: '123',label: 'Burger King',desc: 'Burger King Dallas, TX 75233'},
{id: '234',label: 'Chic Fila',desc: 'Chic Fila Chicago, IL 12255'},
{id: '345',label: 'Chipotle',desc: 'Chipotle Terrell TX 85211'}
];

projects[0].another = 'Another Value';

That will append “another” with the value of “Another Value”

If I understand,
As far as I know,
I wrote this code, İt worked in Firefox.


<script type="text/javascript">


var projects = [
{id: "t123",label: "Burger King",desc: "Burger King Dallas, TX 75233"},
{id: "t234",label: "Chic Fila",desc: "Chic Fila Chicago, IL 12255"},
{id: "t345",label: "Chipotle",desc: "Chipotle Terrell TX 85211"}
];


alert(projects[0].id);  //  t123

alert(projects.toSource());

projects[3] = { id: "t103", label:"The Time Through Ages", desc:"In the Name of Allah, Most Gracious, Most Merciful. 1. By the Time, 2. Verily Man is in loss, 3. Except such as have Faith, and do righteous deeds, and (join together) in the mutual enjoining of Truth, and of Patience and Constancy."};

alert(projects[3].id);      // t103
alert(projects[3].label);   //  The Time Through Ages
alert(projects[3].desc);    //  In the Name of Allah, Most Gracious, Most Merciful. 1. By the Time, 2. Verily Man is in loss, 3. Except such as have Faith, and do righteous deeds, and (join together) in the mutual enjoining of Truth, and of Patience and Constancy.
alert(projects.toSource());

</script>

http://www.w3.org/TR/html4/types.html
ID must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens (“-”), underscores (“_”), colons (“:”), and periods (“.”).