-2

I want to add the row

    ['2008',777,333]

to var fun and maintain the structure:

var fun = [
    ['Year', 'Sales', 'Expenses'],
    ['2004',  1000,      400],
    ['2005',  1170,      460],
    ['2006',  660,       1120],
    ['2007',  1030,      540]
         ];

Using push or concat seems to destroy the structure. Can this be done?

1 Answers1

0
fun.push(['2008', "1033", "554"]) //to add whole row
fun[2].push('555') // to add item into row 3 as the last item
Artsiom Miksiuk
  • 3,896
  • 9
  • 33
  • 49