Removing NaN from date time returned in javascript
问题 I am working on yii2 . In my javascript, I have a formula through which I am getting some data. The data is then passed to chart and chart renders it. var arry_kwh = []; arry_kwh = <?php echo json_encode($dataPointskWh, JSON_NUMERIC_CHECK); ?>; var arry_kwh_diff = []; var i = 0; for (; i < arry_kwh.length - 1; i++) { arry_kwh_diff[i] = { label: arry_kwh[i].label + ((arry_kwh[i + 1].label - arry_kwh[i].label) / 2), y: (arry_kwh[i + 1].y - arry_kwh[i].y) }; } console.log(JSON.stringify(arry_kwh