Avatar of stargateatlantis
stargateatlantis
 asked on

Array Object pushing records

If you look at the commented variable var dataSource; I am trying to reproduce this but the code isn't working when logging it doesn't display the second record with the proper values;

//var dataSource = [{ time: 1730, pwr: 546},{ time: 1731, pwr: 705}];

var chartData=[];
var chartRecord={}

chartRecord["time"] = 1730;
chartRecord["pwr"] = 546;

chartData.push(chartRecord);

chartRecord["time"] = 1731;
chartRecord["pwr"] = 745;

chartData.push(chartRecord);

console.log(chartData);

Open in new window

JavaScript

Avatar of undefined
Last Comment
Robert Schutt

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Robert Schutt

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck