function Vehicle(type) {
this.type = type;
this.wheels = 4;
}
Vehicle.prototype.getInfo = function() {
return `${this.type} with ${this.wheels} wheels`;
};
const car = new Vehicle('sedan');
const bike = Vehicle('motorcycle');
console.log(car.getInfo());
console.log(typeof bike);
console.log(bike?.type || 'undefined'); Post #2934
3.17K
CHALLENGE
- ❤ 6
- 👍 6
- 🔥 3