Last active
December 1, 2022 11:08
-
-
Save senpl/10d030ae0b8cf9444c78e2c014b34ef9 to your computer and use it in GitHub Desktop.
Kontruktor , kopiowanie obiektów i konstruktor kopiujący.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Napisz KlasaA i w niej poleA i poleB | |
Napisz w niej metodę kopiuj która skopiuje do obiektu poleA i poleB. | |
Stwórzmy obiektA który będzie klasy KlasaA | |
Ustawmy mu poleA i poleB. | |
Przypiszmy obiektB do obiektA | |
Zmieńmy w obiektA poleA | |
Wypiszmy z obiektB poleA. | |
//Jak zrobić, żeby zmiany w obiekcieA nie zmieniały danych w obiektB??? | |
import structuredClone from '@ungap/structured-clone'; (https://stackoverflow.com/questions/122102/what-is-the-most-efficient-way-to-deep-clone-an-object-in-javascript) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment