// JavaScript classical inheritance.
function Bird(weight, height) {
// Add method to Bird prototype.
Bird.prototype.walk = function() {
function Penguin(weight, height) {
Bird.call(this, weight, height);
// Prototypal inheritance (Penguin is-a Bird).
Penguin.prototype = Object.create( Bird.prototype );
Penguin.prototype.constructor = Penguin;
// Add method to Penguin prototype.
Penguin.prototype.swim = function() {
// Create a Penguin object.
let penguin = new Penguin(50,10);
// Calls method on Bird, since it's not defined by Penguin.
// Calls method on Penguin.