Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Vehicle(make, model, year) {
- this.make = make;
- this.model = model;
- this.year = year;
- }
- Vehicle.prototype.wheels =4;
- Object.defineProperty(Vehicle.prototype,"wheels",{writable:false});
- var audi_a3 = new Vehicle("Audi","A3","2008");
- var bmw_s_1000_rr = new Vehicle("BMW","S 1000 RR", "2009");
- audi_a3.wheels=4;
- bmw_s_1000_rr.wheels=2;
- Object.defineProperty(Vehicle.prototype,"wheels",{writable:true});
- bmw_s_1000_rr.wheels = 2;
- console.log("Audi has "+audi_a3.wheels+" wheels");
- //Vehicle.prototype.wheels = 2;
- console.log("Audi has "+audi_a3.wheels+" wheels");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement