So we have an array of car objects such as time and speed. We want to create a new object using es6 code and then push it into the array. My code returns null
const carPassing = (cars, speed) => {
class newVehicle {
constructor(time, speed) {
this.time = Date.now();
this.speed = speed;
}
}
console.log(person.time);
console.log(person.speed);
cars.push();
console.log(cars);
return cars;
};