Guest User

Untitled

a guest
Jun 19th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. <script>
  2. // через конструтор //
  3. function car(name,model,color){
  4. this.name = name || "undefined"
  5. this.model = model || "undefined"
  6. this.color = color || "undefined"
  7. }
  8.  
  9. /// через литерал обьекта ///
  10. var car = {band: "BMW" || "black",
  11. kuzov: "sedan",
  12. volume: 4.5,
  13. newL: true,
  14. //METHOD
  15. beep: function(){
  16. alert("beeeep beeeep!")
  17. }
  18.  
  19. }
  20. //dynamic
  21. car.volume++
  22. car.owner = "Bah Ma Vezi";
  23. console.log(car.volume);
  24. console.log(car.owner);
  25. delete car.kuzov
  26. console.log(car.beep())
  27.  
  28. // objects -> design patterns (MVS) //
  29. // -> collections (arrays) //
  30. // -> iterate , search , sort , CRUD/BREAD //
  31. // -> DATABASE //
  32.  
  33. // nav -> object ...<nav id="my-nav">menu...</nav> //
  34. var nav = {
  35. //СВОЙСТВА
  36. id: "main-navigation",
  37. style: {
  38. color: "red",
  39. border: "1px solid black",
  40. margin: "20px" },
  41. content: {
  42. href: "/about.htm",
  43. text: "About sS",
  44. width: "300px";
  45. },
  46. //MERTHOD
  47.  
  48. render: function(){
  49. document.write(`<nav id="${nav.id}" style="color: ${nav.style.color};
  50. border:${nav.style.border};margin:${nav.style.margin}" width:${nav.content.width} >
  51. <a href="${nav.content.href}" title:"${nav.content.text}" >${nav.content.text}</nav>`);
  52. }
  53.  
  54. };
  55. nav.render();
  56.  
  57. alert(nav.style.color);
  58.  
  59. </script>
Add Comment
Please, Sign In to add comment