Advertisement
rraito

OOP in java script

Apr 18th, 2012
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. <html>
  2. <body>
  3. http://www.w3schools.com/jsref/jsref_prototype_math.asp
  4.  
  5.  
  6. http://javascriptweblog.wordpress.com/2010/06/07/understanding-javascript-prototypes/
  7. <script type="text/javascript">
  8.  
  9. function employee(name,jobtitle,born)
  10. {
  11. this.name=name;
  12. this.jobtitle=jobtitle;
  13. this.born=born;
  14. }
  15. var fred=new employee("Fred Flintstone","Caveman",1970);
  16.  
  17. employee.prototype.salary= x();
  18. function x(){return 20000;};
  19. employee.prototype.salarie = function (){return 500;};
  20. document.write(fred.salarie());
  21.  
  22.  
  23. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement