Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- // через конструтор //
- function car(name,model,color){
- this.name = name || "undefined"
- this.model = model || "undefined"
- this.color = color || "undefined"
- }
- /// через литерал обьекта ///
- var car = {band: "BMW" || "black",
- kuzov: "sedan",
- volume: 4.5,
- newL: true,
- //METHOD
- beep: function(){
- alert("beeeep beeeep!")
- }
- }
- //dynamic
- car.volume++
- car.owner = "Bah Ma Vezi";
- console.log(car.volume);
- console.log(car.owner);
- delete car.kuzov
- console.log(car.beep())
- // objects -> design patterns (MVS) //
- // -> collections (arrays) //
- // -> iterate , search , sort , CRUD/BREAD //
- // -> DATABASE //
- // nav -> object ...<nav id="my-nav">menu...</nav> //
- var nav = {
- //СВОЙСТВА
- id: "main-navigation",
- style: {
- color: "red",
- border: "1px solid black",
- margin: "20px" },
- content: {
- href: "/about.htm",
- text: "About sS",
- width: "300px";
- },
- //MERTHOD
- render: function(){
- document.write(`<nav id="${nav.id}" style="color: ${nav.style.color};
- border:${nav.style.border};margin:${nav.style.margin}" width:${nav.content.width} >
- <a href="${nav.content.href}" title:"${nav.content.text}" >${nav.content.text}</nav>`);
- }
- };
- nav.render();
- alert(nav.style.color);
- </script>
Add Comment
Please, Sign In to add comment