I have 2 files. One is car.js
class Car {
constructor(owner){
this.owner = owner;
}
drive(){
console.log("Vroom Vroom");
}
}
The other is race.js from where I want to create a Car object. I tried:
car1 = new Car("Rick Astley");
car1.drive();
But I keep getting the error that
ReferenceError: Car is not defined
What changes should I make to my code ?
(Both files are in the same directory)