
var a = {
    name: "Ivan",
    surname: "Ivanov",
}
var b = {
    name: "Petr",
    surname: "Petrov",
}
var c = {
    name: "Alex",
    surname: "Sidarov",
}

a.age = 20;
b.fathername = "Nikolai";
c.sex = "male";

var persons = [a,b,c,
    {
        name: "pasha",
        surname: "efimenko",
        age: 22
    }
]

var str = "";
str += "<table>"
for (var i = 0; i < persons.length; i++) {
    str += "<tr>"
    var key = Object.keys(persons[i]);
    var j = 0;
    for (var c = 0; c < key.length; c++) {
        j++;
        if(j < 3)
        str += "<td>" + key[c] + ": " + persons[i][key[c]] + "</td>";
    }
    str += "</tr>"
}
str += "</table>";
document.write(str);