Advertisement
DawidKubiak

3 Zadania

Feb 10th, 2021
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Zadanie 1
  2. const prod1={
  3.     name: "Pringles",
  4.     price: 6,
  5.     weight: 160
  6. };
  7.  
  8.  
  9. const prod2={
  10.     name: "Lays",
  11.     price: 5,
  12.     weight: 150
  13. };
  14. document.write("Zadanie 1");
  15. document.write("<br>");
  16. document.write("Produkt numer jeden to: " +prod1.name);
  17. document.write("<br>");
  18. document.write("Produkt numer dwa to: " +prod2.name);
  19. document.write("<br>");
  20. document.write("Produkty kosztują razem: " +(prod1.price + prod2.price));
  21. document.write("<br>");
  22. document.write("Produkty ważą razem: " +(prod1.weight + prod2.weight));
  23. document.write("<br>");
  24. //Zadanie 2
  25. const currentUser={
  26.     name: "Dawid",
  27.     surname: "Kubiak",
  28.     email: "dawidkubiak66@wp.pl",
  29.     www: "www.progi.pl",
  30.     userType: "admin",
  31.     show(){
  32.         document.write("Zadanie 2");
  33.         document.write("<br>");
  34.         document.write("Imię: "+currentUser.name);
  35.         document.write("<br>");
  36.         document.write("Nazwisko: "+currentUser.surname);
  37.         document.write("<br>");
  38.         document.write("E-mail: "+currentUser.email);
  39.         document.write("<br>");
  40.         document.write("Strona www: "+currentUser.www);
  41.         document.write("<br>");
  42.         document.write("Typ użytkownika: "+currentUser.userType);
  43.         document.write("<br>");
  44.     }
  45. };
  46.         currentUser.show();
  47. //Zadanie 3
  48. document.write("Zadanie 3");
  49. const book={
  50.     title: "Stary Człowiek i Morze",
  51.     author: "Ernest Hemingway",
  52.     pageCount: 237,
  53.     publisher: "Wydawnictwo GoG",
  54.     showDetails(){
  55.         for(const key in book)
  56.     {
  57.         document.write(key);
  58.         document.write("<br>");
  59.         document.write(book[key]);
  60.         document.write("<br>");
  61.     }
  62.     }
  63. };
  64. book.showDetails();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement