Issue
dataPoints: [
for(i = 0;i<json.data.length;i++){
{ label: json.data[i][1], y: parseInt(json.data[i][2])}
}]
I have code like that but I see an error on the console
SyntaxError: missing 'of' after for
Does anyone know why? I did search on Google, but nothing can tell me why.
Solution
Obviously, You will get incorrect syntax. Seems you want to create an array so use Array.map()
dataPoints: json.data.map(function (d) {
return {
label: d[1],
y: parseInt(d[2])
}
})
Answered By - Satpal Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.