SOURCE

// function Foo(who) {
//     this.me = who;
// }

// Foo.prototype.identify = function() {
//     return "I am" + this.me;
// }

// function Bar(who) {
//     Foo.call( this, who );
// }

// Bar.prototype = Object.create( Foo.prototype );

// Bar.prototype.speak = function() {
//     alert( "Hello, " + this.identify() + ".");
// };

// var b1 = new Bar( " b1" );
// var b2 = new Bar( " b2" );

// b1.speak();
// b2.speak();

function Product(name, price) {
    this.name = name;
    this.price = price;
}

function Food(name, price) {
    Product.call(this, name, price);
    this.category = 'food';
}

console.log(new Food("cheese", 5).name);
console 命令行工具 X clear

                    
>
console