SHARE
TWEET

Untitled

a guest Nov 18th, 2019 88 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2. <script>
  3.     function Worker (name, surname, rate, days) {
  4.         var salary =0;
  5.         this.getName = function () {
  6.             return name;
  7.         };
  8.         this.getSurname = function () {
  9.             return surname;
  10.         };
  11.         this.days = function (value) {
  12.             if (!arguments.length) return days;
  13.             if(value>=10&&value<=31)
  14.                 days=value;
  15.             else
  16.                 throw "Чо то не так"
  17.         };
  18.         this.rate = function (value) {
  19.             if (!arguments.length) return rate;
  20.             else
  21.                 rate=value;
  22.         };
  23.         this.salary = function (value) {
  24.                 return  rate*days;
  25.             };
  26.     }
  27.     var worker = new Worker("Работяга","Работягович",10,31);
  28.    worker.rate(20);
  29.    worker.days(10);
  30.    console.log(worker.salary())
  31. </script>
  32. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top