Hi everyone! I'm the author of code.mu :)
I'd love to chat with my non-Russian audience. I'm looking for your feedback on the site and the translation quality. Let's chat:)
⊗jsPmObECh 85 of 504 menu
◀ ▶

Changing object elements in JavaScript

Elements of objects can be changed by accessing them by keys. Let's see how it's done. Let's have the following object:

let obj = {a: 1, b: 2, c: 3};

Change the value of its element:

obj['a'] = '!';

Let's use property access:

obj.b = '!';

Check if the object has changed:

console.log(obj);

Given an object:

let obj = {x: 1, y: 2, z: 3};

Square each element of this object.

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