Alex9090

JS POO

Dec 3rd, 2018
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. https://www.w3schools.com/js
  2.  
  3. function MyClass() {
  4. var _value = 1;
  5. this.getValue = function() { return _value; }
  6. }
  7.  
  8. function MyClass() {
  9. var _value = 1;
  10. }
  11. MyClass.prototype.getValue = function() { return _value; }
  12.  
  13.  
  14. <!DOCTYPE html>
  15. <html>
  16. <body>
  17.  
  18. <h2>Pentru ca ne place Javascript</h2>
  19.  
  20. <p id="oras"></p>
  21.  
  22. <script>
  23. var oras = {
  24. nume:"Bucuresti",
  25. densitate:100,
  26. populatie:500000
  27. };
  28. document.getElementById("oras").innerHTML =
  29. oras.nume + " are o populatie de " + oras.populatie + " si o densitate de " + oras.densitate;
  30. </script>
  31.  
  32. </body>
  33. </html>
  34.  
  35. <!DOCTYPE html>
  36. <html>
  37. <body>
  38.  
  39. <h2>Pentru ca ne place Javascript</h2>
  40.  
  41. <p id="pizza"></p>
  42.  
  43. <script>
  44. var pizza = {
  45. tip:"margherita",
  46. marime: "mare",
  47. tipPizza: function() {return "Aceasta pizza este " + pizza.tip + " si " + pizza.marime}
  48. };
  49. document.getElementById("pizza").innerHTML = pizza.tipPizza();
  50. </script>
  51.  
  52. </body>
  53. </html>
Advertisement
Add Comment
Please, Sign In to add comment