Object Properties in OOP in JavaScript
Let's now learn how to work with object properties. Properties allow you to write some data to an object and then read it back. Let's look at an example. Let's say we have an object of the User class from the previous lesson:
javascriptlet user = new User;
Let's write some data to the properties of our object:
javascriptuser.name = 'john';
user.surn = 'smit';
Now let's read these properties:
javascriptconsole.log(user.name);
console.log(user.surn);
Задание 1
In the object of class Employee, write the properties name, age and salary.
Задание 2
Get data from the recorded properties and display it on the screen.