11_HTML.js 497 B

12345678910111213141516171819202122232425262728293031
  1. let persons = [
  2. {
  3. name: 'Sergey',
  4. surname: 'Honcharenko',
  5. age: 28,
  6. isMarried: false,
  7. },
  8. {
  9. name: 'Andrew',
  10. surname: 'Klymchuk',
  11. middleName: 'Anatoliyovych',
  12. haveAJob: true,
  13. },
  14. {
  15. name: 'Alexander',
  16. surname: 'Slobodian',
  17. sex: 'male',
  18. hasAPet: false,
  19. }
  20. ]
  21. let str = "<table>"
  22. for (let key in persons) {
  23. str += `<tr>
  24. <td>${persons[key].name}</td>
  25. <td>${persons[key].surname}</td>
  26. </tr>`;
  27. }
  28. str += "</table>";
  29. document.write(str);