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 =
Solution 1:
You can easily do it by mapping the label
attribute and remove the last 3 characters
like this
data = data.map(el => el.label.substr(0, el.label.length - 3))
Notice: it is recommended the first answer in case of that all objects have NaN at the end of line otherwise use the second solution
or by another way, you can replace
NaN with ""
like this one
data = data.map(el => el.label.replace('NaN', ''))
Post a Comment for "Removing Nan From Date Time Returned In Javascript"