How to add property to an object in JavaScript

preview_player
Показать описание
(We're free online community, meet other makers!)

To add a property to an object in JavaScript use the dot "operator". It's not really an operator, it's just property selector syntax. Anyway, you can also use the [] brackets with a string name. This can be useful because sometimes you want to select properties dynamically based on some generated string value.
Рекомендации по теме