Edit in JSFiddle

/**
 * Calculate the age in years of a person.
 *
 * @param {Person} p A Person object implementing a birth Date parameter.
 * @return {number} The age in years of p.
 */
function calculate_age(p) {
    if (typeof p != "object") {
        throw "Parameter should be an object";
    }
    if (typeof p.birth == "undefined") {
        throw "Parameter should have a birth Bate attribute";
    }
	let thisYear = new Date().getFullYear();
    let personYear = p.birth.getFullYear();
    let age = thisYear - personYear;
    return age;
}

var bertignac = {
    name: "Louis Bertignac",
    birth: new Date(1954, 01, 23)
}

test("Standard usage", function() {
    equal(calculate_age(bertignac), 63);  
    equal(calculate_age({birth: new Date(1954, 01, 23)}), 63);  
});

test("Wrong type parameter", function() {
    throws(function() {calculate_age(1872)}, "Parameter should be an object", "Exception thrown if parameter is a number");
    throws(function() {calculate_age("Something")}, "Parameter should be an object", "Exception thrown if parameter is a string");
});

test("Parameter without birth attribute", function() {
    throws(function() {calculate_age({})}, "Parameter should have a birth Bate attribute", "Exception thrown if parameter is an empty object");
    throws(function() {calculate_age({name: "Jimi Hendrix"})}, "Parameter should have a birth Bate attribute", "Exception thrown if parameter does not have a birth Bate attribute");
});