Properties via constructor parameters in OOP in JavaScript

Variables passed through constructor parameters can be written to the object's properties:

javascriptclass User {
  constructor(name, surn) {
    this.name = name;
    this.surn = surn;
  }
}

Thus, the passed values ​​will become available in all methods of the class. For example, let's use the passed values ​​in some method:

javascriptclass User {
  constructor(name, surn) {
    this.name = name;
    this.surn = surn;
  }
  
  show() {
    return this.name + ' ' + this.surn;
  }
}

Let's check how it works. Let's create a new object, passing the user's first and last name as a parameter:

javascriptlet user = new User('john', 'smit');

Let us now turn to our method:

javascriptconsole.log(user.show());
Задание 1

Pass the employee's name and salary to the Employee class constructor and write them to the corresponding properties.

Задание 2

Create a method that will output the employee's name.

Задание 3

Create a method that will output the employee's salary.

Задание 4

Create a method that will increase the employee's salary by 10%.