Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //ZAD 1
- /*
- const oferta = {
- marka:"Kia",
- model:"Carens",
- cena:60000,
- koszt100km: function(){
- return "37zł"
- }
- }
- document.write(oferta.koszt100km());
- */
- //ZAD 2
- /*
- const pb95 = 6;
- const oferta = {
- marka:"Kia",
- model:"Carens",
- cena:60000,
- spalanie:8,
- koszt100km: function(){
- return this.spalanie * pb95
- }
- }
- document.write(oferta.koszt100km());
- */
- //ZAD 3
- /*
- const oferta = {
- marka:"Kia",
- model:"Carens",
- cena:60000,
- spalanie:8,
- koszt100km: function(){
- return this.spalanie * pb95
- },
- wiekSamochodu:function(){
- let x = prompt();
- x = parseInt(x);
- var d = new Date;
- d = d.getFullYear();
- d = parseInt(d);
- return d - x;
- }
- }
- document.write(oferta.wiekSamochodu());
- */
- // ZAD 4
- const oferta = {
- marka:"Kia",
- model:"Carens",
- cena:60000,
- spalanie:8,
- koszt100km: function(){
- return this.spalanie * pb95
- },
- wiekSamochodu:function(){
- let x = prompt();
- x = parseInt(x);
- var d = new Date;
- d = d.getFullYear();
- d = parseInt(d);
- return d - x;
- }
- }
- function Oferta(mk,md,c,s)
- {
- this.marka = mk;
- this.model = md;
- this.cena =c;
- this.spalanie = s;
- }
- const oferta1 = new Oferta("Volkswagen","Touran",20000,7);
- document.write(oferta1 + "<br>");
- document.write(oferta1.marka + " " + oferta1.model + " " + oferta1.cena + " " + oferta1.spalanie);
Add Comment
Please, Sign In to add comment