Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const FANCY_TOILET = new FancyToilet('Kohler');
- function Toilet(brand) {
- this.brand = brand;
- this.tankCapacity = 4.8;
- }
- Toilet.prototype.sanitize = function() {
- console.log(`Sanititizing ${this.brand}`);
- }
- function FancyToilet(brand) {
- Toilet.call(this, brand);
- // this.constructor = FancyToilet;
- }
- FancyToilet.prototype = new Toilet();
- FancyToilet.prototype.useBidet = function() {
- console.log('Ahh, refreshing!');
- }
- console.log(FANCY_TOILET.constructor);
- FANCY_TOILET.useBidet(); // 'Uncaught TypeError: FANCY_TOILET.useBidet is not a function'
- FANCY_TOILET.sanitize();
- console.log(FANCY_TOILET.brand);
Add Comment
Please, Sign In to add comment