Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!doctype html>
- <html>
- <head>
- <meta charset="UTF-8" />
- <title>Zadania z obiektów</title>
- </head>
- <body>
- <script>
- //zadanie 1
- const prod1 =
- {
- name: 'Telefon',
- price: 5399,
- weight: 212
- }
- const prod2 =
- {
- name: 'Tablet',
- price: 2799,
- weight: 475
- }
- 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>');
- //zadanie 2
- const currentUser =
- {
- name: 'Wiktoria',
- surname: 'Ratajczyk',
- email: 'ratajczyk.wiktoria@wp.pl',
- www: 'facebook.com/shadovmame',
- userType: 'primary',
- show()
- {
- document.write('Imię: ' + this.name + '<br>');
- document.write('Nazwisko: ' + this.surname + '<br>');
- document.write('Email: ' + this.email + '<br>');
- document.write('WWW: ' + this.www + '<br>');
- document.write('Typ członka to: ' + this.userType + '<br>');
- }
- }
- currentUser.show();
- //zadanie 3
- const book =
- {
- title: 'Oksa Pollock: Ostatnia nadzieja',
- author: 'Cendrine Wolf oraz Anne Plichota',
- pageCount: '639',
- publisher: 'Czarna Owca',
- showDetails()
- {
- for(const key in book)
- {
- document.write(key + ': ' + this[key] + '<br>');
- }
- }
- }
- book.showDetails();
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement