I just know a little bit of javascript and appreciate if anyone can help for my question. I have an array like this:
var data = [
{a:44,b:2},
{a:50,b:5},
{a:49,b:7},
{a:41,b:6},
{a:59,b:9},
]
I want to intert a column a1(a1=a-b) in the array.And intert name in only the first two rows of array. Eventually, I want to get the result like this:
var data = [
{a:44,b:2,a1:42,name:"monkey"},
{a:50,b:5,a1:45,name:"dog"},
{a:49,b:7,a1:42},
{a:41,b:6,a1:35},
{a:59,b:9,a1:50},
]
Since I have thousands of rows, it's impossible to do it manually. Can anyone help to write down the code of this transition? Many thanks!