How to fill in the data dynamically?

data: [
 {y: '2011 Q1', item1: 2666},
 {y: '2011 Q2', item1: 2778},
 {y: '2011 Q3', item1: 4912},
 {y: '2011 Q4', item1: 3767},
 {y: '2012 Q1', item1: 6810},
 {y: '2012 Q2', item1: 5670},
 {y: '2012 Q3', item1: 4820},
 {y: '2012 Q4', item1: 15073},
 {y: '2013 Q1', item1: 10687},
 {y: '2013 Q2', item1: 8432}
 ]

The data is initially full, how can I fill dynamically? Through the cycle?
June 10th 19 at 16:29
1 answer
June 10th 19 at 16:31
Solution
Question is not clear, if these data come from the server and you need such a structure that:
const data = [...].map(({ y, item1 }) => ({ y, item1 }))
Yeah, sorry, I poorly asked the question, but I think this is exactly what I needed, thanks! - Myrtice commented on June 10th 19 at 16:34
Super, put, then, that the question is solved, good luck! - gloria commented on June 10th 19 at 16:37
Hey, do you know how few to do with the map first meet. - Myrtice commented on June 10th 19 at 16:40
SyntaxError: expected expression, got ']' - Myrtice commented on June 10th 19 at 16:43
Mmm, and more? Code listing put - gloria commented on June 10th 19 at 16:46
Understood, but I slightly differently made, but nevertheless thank you, this helped! - Myrtice commented on June 10th 19 at 16:49

Find more questions by tags jQueryJavaScript