Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const prod1 = {
- name : "Kustosz",
- price : 4.99,
- weight : 0.3
- }
- const prod2 = {
- name : "Mąka",
- price : 4.99,
- weight : 1
- }
- document.write(`Produkt numer 1 to: ${prod1["name"]}<br>`);
- document.write(`Produkt numer 2 to: ${prod2["name"]}<br>`);
- document.write(`Produkty kosztują razem: ${prod2["price"] + prod1["price"]} zł<br>`);
- document.write(`Produkty ważą razem: ${prod2["weight"] + prod1["weight"]} kg`);
- const currentUser = {
- name : "Marcin",
- surname : "Król",
- email : "[email protected]",
- www: "github.com/marcin_krol",
- userType: "Male",
- show() {
- document.write(`Imię: ${this.name}<br>`);
- document.write(`Imię: ${this.surname}<br>`);
- document.write(`Imię: ${this.email}<br>`);
- document.write(`Imię: ${this.www}<br>`);
- document.write(`Imię: ${this.userType}<br>`);
- }
- };
- currentUser.show();
- const book = {
- title : "JavaScript - Interaktywne Aplikacje Internetowe",
- author : "Tomasz Sochacki",
- pageCount : 200,
- publisher : "Helion",
- showDetails() {
- for (const key in book){
- document.write(`${key} : ${this[key]} <br>`);
- }
- }
- };
- book.showDetails();
Advertisement
Add Comment
Please, Sign In to add comment