mituri

[JS] Wzorzec modułu

Mar 27th, 2018
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. var Rectangle = (function() {
  2. var constr,
  3. a,
  4. b;
  5.  
  6. constr = function(a, b) {
  7. this.a = a;
  8. this.b = b;
  9. }
  10. constr.prototype = {
  11. getArea: function() {
  12. return this.a * this.b;
  13. },
  14. getPerimeter: function() {
  15. return 2 * (this.a + this.b);
  16. }
  17. }
  18. return constr;
  19. })();
Advertisement
Add Comment
Please, Sign In to add comment