Следите за новинками
в нашем Telegram канале. Жми, чтобы подписаться:)
⊗jsOpBsMO 4 of 60 menu
◀ ▶

Multiple objects of the same class in OOP in JavaScript

You can create several objects of the same class. For example, let's create two users:

let user1 = new User; let user2 = new User;

Let's give them names:

user1.name = 'john'; user2.name = 'eric';

Let's output these names:

console.log(user1.name); console.log(user2.name);

Create some objects of class Employee.

Write down the name and salary of each employee in the property.

Display the sum of the salaries of the workers you have created.

← →
↑
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