比如有数据
years = ['2018','2019','2020','2021']
sale = [ 1000,2000,3000,4000]
要生成一个对象型数组
[{
x:'2018',
y:1,
'text':'1000',
'other_key':'other_value',
}
...
{
x:'2021',
y:1,
'text':'4000',
'other_key':'other_value',
}]
我想用 数组的map来着。可是函数体里面又不能使用 冒号。咋解?
谢谢!