Javascript 如何在typescript中创建函数
1.我有如下数据:Javascript 如何在typescript中创建函数,javascript,typescript,Javascript,Typescript,1.我有如下数据: [{ "BatchConfigName": "End1", "EndDateTime": "2019-01-06T11:10:00" }, { "BatchConfigName": "End2 - Non-Gas", "EndDateTime": "2019-01-07T05:54:00" }, { "BatchConfigName": "Secure", "EndDateTime": "2019-01-0
[{
"BatchConfigName": "End1",
"EndDateTime": "2019-01-06T11:10:00"
},
{
"BatchConfigName": "End2 - Non-Gas",
"EndDateTime": "2019-01-07T05:54:00"
},
{
"BatchConfigName": "Secure",
"EndDateTime": "2019-01-07T04:48:00"
}
}
var datawebsiteViewsChart = {
labels: ['End1', 'End2 - Non-Gas', 'Secure'],
series: [
[11: 10, 05: 54, 04: 48]
]
};
没有@ArvindChaudhary我理解你的挣扎,但请试着理解,有时候这些挣扎会帮助你成为一名更好的程序员。您可以尝试教程网站了解更多信息。以下是一个例子:
function map(data) {
const labels = [];
const series = [];
for (itemKey of data) {
labels.push(itemKey);
series.push(data[itemKey]);
}
return {
labels,
series
};
}