Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Document</title>
- </head>
- <body>
- <script>
- //Zad1
- {
- function Prod(name, price, weight)
- {
- this.name = name;
- this.price = price;
- this.weight = weight;
- };
- let prod1 = new Prod("Pasztet Piekło w gębie", 5.50, 1);
- let prod2 = new Prod("Kiełbasa Długa", 22.45, 5);
- document.write("Produkt numer jeden to: "+prod1.name+"</br>");
- document.write("Produkt numer dwa to: "+prod2.name+"</br>");
- document.write("Produkty kosztują razem: "+(prod1.price+prod2.price)+"</br>");
- document.write("Produkty ważą razem: "+(prod1.weight+prod2.weight)+"</br>");
- }
- //Zad2
- {
- currentUser = {
- name: "Piotr",
- surname: "Jurek",
- email: "scisle@tajne.com",
- www: "www.www.com.edu.pl",
- userType: "ja",
- show()
- {
- document.write("Imię: "+this.name+"</br>");
- document.write("Nazwisko: "+this.surname+"</br>");
- document.write("Email: "+this.email+"</br>");
- document.write("Strona internetowa: "+this.www+"</br>");
- document.write("Typ użytkownika: "+this.userType+"</br>");
- }
- }
- currentUser.show();
- }
- //Zad3
- {
- book = {
- title: "Pani Tadeusz",
- author: "Adam Małysz",
- pageCount: 999,
- publisher: "Adam Małysz wielkim poetą był",
- showDetails()
- {
- for(const x in this)
- {
- document.write(x+": "+this[x]+"</br>");
- }
- }
- }
- book.showDetails();
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement