I'm currently working on pushing data from an API into an array of objects.
This is what I want:
myFXdata {[ccypair], [resistance], [support], [trend.src]},
{[ccypair], [resistance], [support], [trend.src]},
{[ccypair], [resistance], [support], [trend.src]},
{[ccypair], [resistance], ...etc},
However, this is the result I get:
myFXdata {[ccypair], [resistance], [support], [trend.src],
[ccypair], [resistance], [support], [trend.src],
[ccypair], [resistance], [support], [trend.src],
[ccypair], [resistance], ...etc}
This is my code:
var myFXdata = [];
for (var i = 0; i < collection.length; i++){
myFXData.push((collection[i].ccyPair), (collection[i].resistance), (collection[i].support), (collection[i].trend.src));
}
console.log(dailyfxTech)
I believe I need to push into a new object each time, but when I try:
myFXData.push({collection[i].ccyPair});
I encounter this error:
SyntaxError: Unexpected token '['. Expected a ':' following the property name 'collection'.
Any suggestions?