JAVASCRIPTV Telegram 1637
Что выведет этот код и почему?

❗️ Ответ:

31
31

🔍 **Объяснение:**

1. **Создание объекта `person1`:** Объект `person1` создаётся со свойствами `name` и `age`.
2. **Присвоение `person2 = person1`:** Здесь не создаётся копия объекта `person1`, а создаётся ссылка на тот же объект в памяти. Таким образом, `person1` и `person2` указывают на один и тот же объект.
3. **Изменение свойства `age` у `person2`:** При изменении `person2.age` это изменение влияет и на `person1.age`, так как оба идентификатора указывают на один и тот же объект.
4. **Вывод `person1.age` и `person2.age`:** Оба значения будут равны `31`, поскольку изменение `person2.age` также изменило `person1.age`.


@javascriptv
Please open Telegram to view this post
VIEW IN TELEGRAM
👍649😁4🔥3



tgoop.com/javascriptv/1637
Create:
Last Update:

Что выведет этот код и почему?

❗️ Ответ:

31
31

🔍 **Объяснение:**

1. **Создание объекта `person1`:** Объект `person1` создаётся со свойствами `name` и `age`.
2. **Присвоение `person2 = person1`:** Здесь не создаётся копия объекта `person1`, а создаётся ссылка на тот же объект в памяти. Таким образом, `person1` и `person2` указывают на один и тот же объект.
3. **Изменение свойства `age` у `person2`:** При изменении `person2.age` это изменение влияет и на `person1.age`, так как оба идентификатора указывают на один и тот же объект.
4. **Вывод `person1.age` и `person2.age`:** Оба значения будут равны `31`, поскольку изменение `person2.age` также изменило `person1.age`.


@javascriptv

BY Javascript




Share with your friend now:
tgoop.com/javascriptv/1637

View MORE
Open in Telegram


Telegram News

Date: |

While some crypto traders move toward screaming as a coping mechanism, many mental health experts have argued that “scream therapy” is pseudoscience. Scientific research or no, it obviously feels good. Deputy District Judge Peter Hui sentenced computer technician Ng Man-ho on Thursday, a month after the 27-year-old, who ran a Telegram group called SUCK Channel, was found guilty of seven charges of conspiring to incite others to commit illegal acts during the 2019 extradition bill protests and subsequent months. The creator of the channel becomes its administrator by default. If you need help managing your channel, you can add more administrators from your subscriber base. You can provide each admin with limited or full rights to manage the channel. For example, you can allow an administrator to publish and edit content while withholding the right to add new subscribers. The Standard Channel Ng was convicted in April for conspiracy to incite a riot, public nuisance, arson, criminal damage, manufacturing of explosives, administering poison and wounding with intent to do grievous bodily harm between October 2019 and June 2020.
from us


Telegram Javascript
FROM American