Reputation: 463
I have the following array of objects (as shown below) as graphdatalogs
I am trying to create a new array of objects called graphdata with x and y as properties from graphdatalogs
I tried the following javascript map method but I am getting compile error as shown below.
return this.state.graphdataLogs.rows._array.map(
(ae) => (graphdata.push(x:ae.logstringdate.substring(4,10),y:metricweight));
);
Error Message
Parsing error: Unexpected token, expected , (Fatal)
Can someone let me know what I am doing wrong ?
Upvotes: 0
Views: 108
Reputation: 20885
You forgot the curly braces
return this.state.graphdataLogs.rows._array.map(
(ae) => (graphdata.push({x:ae.logstringdate.substring(4,10), y:metricweight}));
);
Upvotes: 2