⊗jsOpBsOP 3 of 60 menu

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:

let user = new User;

Let's write some data to the properties of our object:

user.name = 'john'; user.surn = 'smit';

Now let's read these properties:

console.log(user.name); console.log(user.surn);

In the object of class Employee, write the properties name, age and salary.

Get data from the recorded properties and display it on the screen.

English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline