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 += "" for (var i = 0; i < persons.length; i++) { str += "" var key = Object.keys(persons[i]); for (var c = 0; c < key.length; c++) { if(c < 3) str += ""; if(c >= 3 && key[c] in persons[i]) str += ""; } str += "" } str += "
" + key[c] + ": " + persons[i][key[c]] + "" + key[c] + ": " + persons[i][key[c]] + "
"; document.write(str);