Valeri173

Untitled

Jan 24th, 2022
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3.  
  4. <head>
  5. <meta charset="utf-8">
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  7. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  8. <title>Задача с обект</title>
  9. </head>
  10.  
  11. <body>
  12. <p id="info"></p>
  13.  
  14. <script>
  15. function Book(title, author, publisher, edition, numofpages) {
  16.  
  17. this.title = title;
  18. this.author = author;
  19. this.publisher = publisher;
  20. this.edition = edition;
  21. this.numofpages = numofpages;
  22. }
  23.  
  24. var book1 = new Book("Има ли живот на Марс", "Оскър Уайлд", "eBooks", "4", "176");
  25. var book2 = new Book("NASA", "Джордж Грейв", "OpenBook", "1", "143");
  26.  
  27.  
  28.  
  29.  
  30. var text1 = "";
  31. for(let x in book1){
  32. text1 += book1[x] + " "
  33. }
  34.  
  35. var text2 = "";
  36. for(let x in book2){
  37. text2 += book2[x] + " ";
  38. }
  39. document.getElementById("info").innerHTML = text1 + "<br>" + text2;
  40. </script>
  41. </body>
  42.  
  43. </html>
Advertisement
Add Comment
Please, Sign In to add comment