JavaScript

Inheritance Example

//Create a new object which inherits from o.
function object(o) {
    function F() {};
    F.prototype = o;
    return new F();
}

var human = {
    name: "Floyd",
    age: 33,
    sex: "Male",
}

var employee = object(human);

employee.salary = 100;
employee.name;

human.name = 'Pink';

employee.name;

employee.name = 'Blue';

human.name;


José M. Vidal .

55 of 65